-
Posts
902 -
Joined
-
Last visited
-
Days Won
9
Everything posted by doddsey_65
-
i have the following which sends an email whenever a post is made within the topic the user is subscribed to. However it still sends the email to the person who made the reply. I need to take out the email of the poster if they are in the notification list. This is what i have but it doesnt seem to remove them. $notification_query = $db->query("SELECT u.user_id, u.user_email, u.user_username, n.notification_user_id FROM ".DB_PREFIX."members as u LEFT JOIN ".DB_PREFIX."notifications as n ON n.notification_user_id = u.user_id WHERE n.notification_topic_id = '$post_id'") or trigger_error("SQL", E_USER_ERROR); $num_rows = mysql_num_rows($notification_query); while ($notification_list = mysql_fetch_object($notification_query)) { $users4[] = $notification_list->user_email; } $emailAddress = implode(', ', $users4); if (in_array($_SESSION['user_username'], $emailAddress)) { $emailAddress = str_replace($_SESSION['user_username'], ' ', $emailAddress); } if ($num_rows >=1) { putenv('TZ=EST5EDT'); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: [email protected]' . "\r\n"; $message .= "A Reply Has Been Made To {$_POST['subject']}.<br /><br />"; $message .= "You are receiving this message because you have subscribed to the topic {$_POST['subject']},<br /> which has a new post since your last one.<br />"; $message .= "Click the link below to view the new thread now.<br />"; $message .= "<a href=\"{$site_root}/index.php?forum={$forum_id}\"> {$site_root}/index.php?forum={$forum_id}&topic={$thread_topic_id}</a><br /> <br />To Unsubscribe from this topic visit the link below.<br /><br /> <a href=\"{$site_root}/subscribe.php?forum={$forum_id}&topic={$topic_id}&uid={$notification_list->user_id}&do=unsubscribe\"> {$site_root}/subscribe.php?forum={$forum_id}&topic={$topic_id}&uid={$notification_list->user_id}&do=unsubscribe</a><br /><br /> Thanks"; $subject = "A Reply Has Been Made To {$_POST['subject']}."; mail($emailAddress,$subject,$message,$headers); } }
-
i fixed it. $content1 didnt just contain the usernames it also contained a <span> which had a class grabbed from a switch. I just reordered a few things and added the span to the javascript before content1 was called.
-
i got firebug but dont know how to use it, so i dont know about any errors. I have tried your code and the same thing happens. It just echoes the html after the mouseover. You can see it here: http://www.thevault.cz.cc/index.php?forum=1&topic=52
-
no one know the answer? or is this too easy that i should figure it out myself? ive tried several different methods but cant get it to work.
-
I have this javascript code which uses mouseover for a tooltip. It works fine until i add php. Anyone know how i could add the php variable? Here is the original code: <span class="users_browsing" onmouseover="tooltip.show('hi');" onmouseout="tooltip.hide();"> Ive tried this but it doesnt work: echo "<span class=\"users_browsing\" onmouseover=\"tooltip.show(\"{$content1}\");\" onmouseout=\"tooltip.hide();\"> Users Browsing Forum: {$browsers_num}</span>";
-
I have the following which fils a combo box with years from 1950 to 2100. This is the year box for the date of birth. Year <select name="year_select"> <?php for( $i=1950; $i<=2100; $i++ ) { echo "<option value=\"{$i}\" class=\"year\">{$i}</option>"; } ?> </select> I want it to automatically display the year that is in the database so instead of automatically displaying 1950 i want their birth year displayed which is $tab_info->user_dob_year. How would i go about this? i dont know where to start since im using a for loop to populate it.
-
thanks it works perfectly.
-
Im working with the animatedcollapse.js file which collapses divs. I need to collapse divs with the id's 1,2,3,4. Simple enough. However they wont always be 1,2,3,4 as these are the ids (forum_id) pulled from the database. the animatedcollapse.js script requires the names of the divs to be entered like so: <a href=\"javascript:animatedcollapse.show(['1','2','3','4'])\"> but like i said it won't always be 1,2,3,4 so how can i pull the id's and add them to that href? i was thinking an array but ive never worked with them before so i cant get it to work. I need to pull all of the forum_id's where parent_id = 1 and then add the id's to the href.
-
i have some javascript which should show the messages at the side of the input but they arent and i dont know where im going wrong. <script language="javascript"> $(document).ready(function() { $("#fullname").blur(function() { //remove all the class add the messagebox classes and start fading $("#msgbox1").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow"); $.post("update.php",{ fullname:$(this).val() } ,function(data) { if (data==1) { $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Update Successful').addClass('messageboxerror').fadeTo(900,1); }); } else { $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Error Updating').addClass('messageboxerror').fadeTo(900,1); }); } }); }); }); </script> <input class="input2" id="fullname" type="text" name="fullname" value="<?php echo $tab_info->user_real_name; ?>" /> <span id="msgbox1" style="display:none"></span> ive used this before and it worked but not this time. ANyone know why?
-
chrome and safari are based on the same webkit which is why that is shown as your browser. I will change it in due course but its only a small error.
-
$users2 = array();
-
i have a users online section and i am using an aray and implode so the comma is displayed on every username but the last, but it displays the same usernames several times. This could be due to the switch i am using to define user group. Heres the code: $online_query = $db->query("SELECT user_id, user_group, user_username FROM ".DB_PREFIX."sessions"); while ($online_info = mysql_fetch_object($online_query)) { switch($online_info->user_group) { case 1: $userClass = 'admin'; break; case 2: $userClass = 'mod'; break; case 3: case 0: default: $userClass = 'user'; break; } $users2[] = "<span class=\"{$userClass}\">{$online_info->user_username}</span>"; echo '<p>' . implode(', ', $users2) . '</p>'; } is there something i am doing wrong?
-
i have some code which sends a confrim link via the posted email. In hotmail it works fine, once the link is clicked they are confirmed but gmail adds %09 to the link making it break. example WHERE hash = their email hashed posted email = [email protected] confirm link(hotmail) confirm.php?email=HASH&[email protected](works) confirm link(gmail)confirm.php?email=%09HASH&[email protected](Doesnt work) anyone know why gmail does this?
-
thanks but i got around it by adding the POST data and $old content into one variable and then using that.
-
also tried: SET post_content = post_content AND '".$_POST['test']."' it just keps updating the colum with 0
-
i am trying to update a column in the database. I can update int columns but what about text? i want to update it so that the new text is added to it while keeping the old one. Here is what i have(which isnt working): mysql_query("UPDATE ".DB_PREFIX."posts SET post_content = '$old_content' + '".$_POST['test']."' WHERE post_id = '$double_post_id'") or die(mysql_error()); i have also tried: SET post_content = post_content + '".$_POST['test']."' but that didnt work either. What should i be doing?
-
in my login script i have the following which searches for the username they inputted and then adds their user id to the table sessions in the database. $result = mysql_query("SELECT * FROM ".DB_PREFIX."members WHERE user_username = '$username' AND user_password = '$password'"); if(mysql_num_rows($result) != 1) { $val_error = 'Username and Password incorrect.'; } else { $row = mysql_fetch_array($result); $browser = $_SERVER['HTTP_USER_AGENT']; $_SESSION['user_id'] = $row['user_id']; $_SESSION['session'] = session_id(); mysql_query("INSERT INTO ".DB_PREFIX."sessions VALUES(NULL, '".$_SESSION['user_id']."', '".$_SESSION['session']."', '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['HTTP_USER_AGENT']."', '".date('Y-m-d')."')"); if ($_SESSION['backpage']) { header('Location: '.$_SESSION['backpage']); } else { header('Location: index.php'); } } then on pages which i want only logged in members to access i have the following: if ($_SESSION['user_id'] == '') { header ('Location: '.SITE_ROOT.'/login.php'); } else { REST OF CODE } but when i login and try to access a page which requires you to be logged in i am directed back to index.php. I have nothing which does that. if you are not logged in you are redirected to login.php but it doesnt seem to work. Any ideas?
-
"SELECT * FROM photos ORDER BY album_id" if you need more help let me know
-
$query = "SELECT * FROM account_info"; you are selecting everyone from account_info try: $query = "SELECT * FROM account_info WHERE username = '".$_POST['username']."'"; that will make sure you are only selecting the user who registered by pulling what they added in the username field
-
my index.php file includes different files depending on the get value. all of them work except this one: elseif (isset($_GET['forum']) && $_GET['child']) { include 'modules/pages/children.php'; } when i point my browser to index.php?forum=1&child=1 it stays on the same page. Do i need to include something else when getting a url with 2 $_GETs?
-
I have some javascript for a tabbed interface in index.php. The content of each tab is in content.php which uses $_GET to define which tab is selected. But i want to include queries based on variables from index.php how would i do this? here is the code for the tabbed interface: <script language="JavaScript" type="text/javascript" src="<?php echo SITE_ROOT; ?>/js/ahahLib.js"></script> <script language="JavaScript" type="text/javascript"> function makeactive(tab) { document.getElementById("tab1").className = ""; document.getElementById("tab2").className = ""; document.getElementById("tab3").className = ""; document.getElementById("tab"+tab).className = "active"; callAHAH('includes/content.php?content= '+tab, 'content', 'Loading...', 'Error'); } </script> <ul id="tabmenu" > <li onclick="makeactive(1)"> <a class="" id="tab1">Account Information</a> </li> <li onclick="makeactive(2)"> <a class="" id="tab2">Second Page</a> </li> <li onclick="makeactive(3)"> <a class="" id="tab3">Third Page</a> </li> </ul> <div id="content"></div> and the code in content.php if ($_GET['content'] == 1) { echo 'Content for Page 1'; } if ($_GET['content'] == 2) { echo 'Content for Page 2'; } if ($_GET['content'] == 3) { echo 'Content For Page 3'; } ive tried adding the variable $user_id to the content.php url as follows: callAHAH('includes/content.php?user=$user_id&content= '+tab, 'content', 'Loading...', 'Error'); } but that just brought up an error.
-
hi, i am looking for some code which will automatically update a div. the div will be updated to what the user types in the textbox automatically. I did have this feature working but for some reason it stopped working. If anyone could point me in the right direction or tell me why my code isnt working anymore. Heres the code: <script src="<?php echo SITE_ROOT; ?>/js/jquery.min.js" type="text/javascript"> </script> <script src="<?php echo SITE_ROOT; ?>/js/jquery.bbcode.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $("#test").bbcode({}); process(); }); var bbcode=""; function process() { if (bbcode != $("#test").val()) { bbcode = $("#test").val(); $.get('bbParser.php', { bbcode: bbcode }, function(txt){ $("#preview").html(txt); }) } setTimeout("process()", 2000); } </script>
-
up until yesterday everything was fine, but now all of my icons are displaying at 10 times the size they originally are. This can only be fixed by defining width and height of them via css but i never had to do this before. Is this something to do with php? heres an eample line of code for an image i am using: echo "<img src=\"{$site_root}/avatars/{$posts_info->user_avatar}\"/>"; any ideas why this is happening? that image is just an example btw. the same thing happens with icons that are 7x7.
-
Hi, i am wanting to implement a post restriction on the forum im building where a new user can only post 10 posts per day and create 2 topics per day. I have thought about the process but have become stuck. I am fine for checking if they have reached their post count for the day(just a simple +1 to the table when they post then query it before posting) but how would i reset the counter after the day is up? i have also done the bit that defines how long ago they registered. So if a user registered less than 1 week ago they are only permitted 10 posts and 2 topics per day. After the day ends they can post 10 more posts and 2 more topics(numbers are examples only). Then when they pass 1 week registered they can do anything. I just dont know how to reset the counter at the end of the day. This is my example code so far: $timeslot = (strtotime("-1 week")); $reg_date = (strtotime($posts_info->user_regdate)); if ($reg_date <= $timeslot) { THEY CAN DO ANYTHING } else { if $todays_post_count == 10) { THEY CANT POST } else { THEY CAN POST }
-
I have a query which pulls all the data i need and it works fine. But when there is more than one topic in a forum it displays the forum each time. Say there are 4 topics in a forum. The forum name is displayed 4 times. Heres the code: $query = $db->query("SELECT f.forum_id, f.forum_name, f.forum_description, f.forum_topics, f.forum_posts, f.forum_last_poster, f.forum_last_post_time, f.forum_last_post, p.parent_id, p.parent_name, m.user_id, m.user_username, m.user_group, t.topic_id, t.topic_name, po.post_id, po.post_subject FROM ".DB_PREFIX."forums as f JOIN ".DB_PREFIX."parents as p ON f.parent_id = p.parent_id LEFT JOIN ".DB_PREFIX."members as m ON f.forum_last_poster = m.user_id LEFT JOIN ".DB_PREFIX."topics as t ON f.forum_id = t.forum_id LEFT JOIN ".DB_PREFIX."posts as po ON po.post_id = f.forum_last_post ORDER BY p.parent_id") or trigger_error("SQL", E_USER_ERROR); while ($forum_info = mysql_fetch_object($query)) { I am new to table joins but someone helped me set this up so it should work but it doesnt. Any ideas why?