-
Content Count
958 -
Joined
-
Last visited
-
Days Won
5
Everything posted by sonesay
-
ok I'll try help out more. Dinner soon for me so when its done I'll edit this reply.Edit:Ok looking through the code you changed alot of names for the variables but didnt change them further down the code when you use them. $Voornaam = trim(addslashes(strip_tags($_POST['First'])));$Naam = trim(addslashes(strip_tags($_POST['Name'])));$Stad = trim(addslashes(strip_tags($_POST['Town'])));$Land = trim(addslashes(strip_tags($_POST['Country'])));$Epost = trim(addslashes(strip_tags($_POST['Email'])));mysql_select_db("tester", $con);mysql_query("INSERT INTO newsletter VALUES ('','$First','$Name','$Town','$Country','$Email','')") or die(mysql_error()); Change it to this and you wont get those undefined variable errors. $First = trim(addslashes(strip_tags($_POST['First'])));$Name = trim(addslashes(strip_tags($_POST['Name'])));$Town = trim(addslashes(strip_tags($_POST['Town'])));$Country = trim(addslashes(strip_tags($_POST['Country'])));$Email = trim(addslashes(strip_tags($_POST['Email'])));mysql_select_db("tester", $con);mysql_query("INSERT INTO newsletter VALUES ('','$First','$Name','$Town','$Country','$Email','')") or die(mysql_error()); The error you get from undefined confirm_id Notice: Undefined variable: confirm_id in c:\program files\easyphp1-8\home\confirm.php on line 22is because of $result Query failing. the following code should work. $result = mysql_query("Select id from newsletter where Email ='".$Email."'");
-
Forums are a great tool for communication. Sure theres chat rooms but nothing gets saved in there. Without forumns how do you think we'd be communicating. They are able to be acess by almost anyone. When I google for a specific topic or problem it usally takes me to a forum where the topic is being discussed."Forums are used in basically every website that isn't professional". LOL serisouly how can you say that. There are many big companies using forums for support and documentation. Its just that forums are easy to setup by anyone with little knowledge that it looks unprofessional. I guess what makes a forum good is if its very active and have good content. I come to forums when im bored yes but there are other reasons too like finding information.
-
In your first page you are inserting records into a database mysql_query("INSERT INTO newsletter VALUES ('','$First','$Name','$Town','$Country','$Email','')") or die(mysql_error()); from the above code: VALUES ('' is the key you want to retrive and use to distinguish between each unique user and use it in confirm.php later to set the 'active' field for when users subscribe. So you will need to get this key(id) somehow to be able to use it in confirm.php. i dont think mysql stored it after executing an insert query you may have to do an additional query to retrieve it. maybe something like(if the key is called id) } linenums:0'>$result = mysql_query("Select id from newsletter where email =". $Email);while($row = mysql_fetch_array($result)){ $confirm_id = $row['id'];} Then when the key is set you can use it "Hello, $First, Thank you for subscribing to our newsletter.\n Click the link below to confirm your subscription:\n [url="LOCALHOST/home/confirm.php?confirm_id=""]http://localhost/home/confirm.php?confirm_id="[/url]. $confirm_id." \n Kind regards,\n The webmaster.\n $site\n"; This line here where you do the update is wrong mysql_query("UPDATE newsletter SET active='1' WHERE $confirm_id='$id'") or die(mysql_error());$id not defined and you do not need to because you want to insert into id not assign id to $confirm_id in a sql statement. so it should be something like this mysql_query("UPDATE newsletter SET active='1' WHERE id = '".$confirm_id."'") or die(mysql_error());
-
Watch Star Wars Inside Cmd Watch Star Wars inside CMD
sonesay replied to AcaiR's topic in General Discussion
Original Work : Simon Jansen ( http://www.asciimation.co.nz/ ) Telnetification : Snore ( http://blinkenlights.nl/ ) Improved player : Mike Edwards (pf-asciimation@mirkwood.net) Heh Nice find I notice this guys from nz. what a small world this is. -
Ok I did poorly in my database class so Im very bad at normalizing forms. I started creating my database and eventually ran into a problem with how I've set it up. Im not 100% sure how I'm going to fix it at this stage but heres the problem.I have 2 tables MONSTER and ITEMS. Basically its layed out like this. MONSTER TABLE--------------------m_id int (PK)m_name varcharm_level int...etcITEMS TABLE--------------------i_id int (PK)i_name varchari_nm int I'm using them like this. item (Big sword with i_nm = 1) so the big sword drops off the monster of m_id of 1. I think this is what you call a 1 to 1 relationship. Later on I find out that the big sword with i_nm of 1 can also drop off another monster so it is a 1 to many. I cant figure out how im going to alter my table to address this. I dont want to insert 2 similar items into the ITEMS table with 2 different i_nm ids to link them to each NM.
-
Mkportal Help need help with php in mkportal
sonesay replied to silver_wolves's topic in Programming
I am just curious what game are you playing or is that for? I dont use mk portal and have no idea what smf is but i find what your doing is interesting. Im making a custom management system myself for ffxi online RPG. At this stage its only going to feature news, scheduled events, recruiting and attenance for members. It will handle points/hours farmed and distrobution of drops too. But im not merging it with any CMS or forums because that would be pretty hard its pretty much a stand alone system for now.If im not mistaken MKportal is a cms and has forums etc? I've never tried adding any new features (or custom ones) to a CMS but Im guessing if you want to extend it you'll have to understand how they work and how their databases are layout. I was using a CMS for my old forums before it was called fusion(if i can remember correctly), I wanted to customize myself with tools for managing my ffxi game community but when i looked through the source code (lol) it was too much to understand for me. There was code i'd never seen before and so many includes. Eventually I gave up on that idea since I dont fully understand or know enough to be able to modify it. So thats how I got started on writing my own from scratch it was much easier then trying to extend it on to something i hardly understood. I think if you can view the database in myphp admin or w/e then you can get a good idea of whats being stored and what you need to store to include your custom features.Good luck Im sorry I cant think of anything else that will help. -
That type of menu is very common on the web. the css code you posted dosent seem to match the html file. <link rel="stylesheet" type="text/css" href="http://forums.xisto.com/no_longer_exists/; /> that css file was way to long I didnt want to look through it all i just did a search for 'menucontainer' which the menu uses and it wasnt in there. I found this example thats similar and the code is short maybe you should have a look. The images used are different but layout seems the same and less code. http://www.dynamicdrive.com/style/csslibraoors-tabs-menu/
-
Hmm If you just want to build a site quickly and not be too concerned about doing many updates often then html and javascript will do fine. You will build it quicker with just html and javascript but if you want to do more complex things then having PHP gives you abit more control. Theres many languages to learn if you want to do alot of neat things in web but the core ones are HTML, Javascript, CSS if you have time learn these first.
-
I did a search on google and found this. http://forums.xisto.com/no_longer_exists/ SELECT RecordIdFROM TableWHERE RecordIdIN ( SELECT RecordId FROM Table ORDER BY RecordId DESC LIMIT 100)ORDER BY RecordId ASC as for setTimeOut() I've used it twice.I think this would work } linenums:0'>function Ajax*() { ... ..setTimeOut('Ajax*();', 2000 );} I think what you want to use for this function is for <body onload='' so that it start right away refreshing the post. Im not sure how it will work when you submit the from with another ajax update. I think it will continue working. Good luck.
-
Yeah it looks like the function im after i'm going to give it a try now thanks will update with results soon. Update: Seems to work fine under fire fox but in safari it gets stuck on the loading part. Heres the code I am using function add_on_time(id, container){ //var form = $F(id); var opt = { onLoading: function(){$(container).innerHTML = 'Loading...';}, onSuccess: function(transport){$(container).innerHTML = transport.responseText;} //onSuccess: function(transport){document.getElementById(container).innerHTML = transport.responseText;} } new Ajax.Request('includes/_events_locked_add_on_time.php?event_id='+id, opt); } Both the first and second onSuccess: lines work under firefox but not safari. /sigh another update: Ok I found some weird problems Im not sure whats causing it. I am using XAMPP for MacOS X 0.6.2. - sometimes (1/10) it would finish loading on the safari page when the ajax request is started(ajax request is successful). - I would get delays sometimes on the firefox page. i.e it would be stuck on loading... status just like the safari one. Through out my page I have mulitple mysql queries which I use from $link $elock_result = mysql_query($elock_query, $link) or die ("Cannot lock event"); // get event $e1_query = "SELECT * FROM events WHERE e_id = ".$event_id; $e1_result = mysql_query($e1_query, $link) or die("Cannot return events"); // query for events attendance $ea_query = "SELECT * FROM events_attend WHERE ea_event_id =".$event_id; $ea_result = mysql_query($ea_query, $link) or die("Cannot return members from events_attend"); linenums:0'>// set event to lock.$elock_query = "UPDATE events SET e_status = 'Active Locked' WHERE e_id =".$event_id;$elock_result = mysql_query($elock_query, $link) or die ("Cannot lock event");// get event$e1_query = "SELECT * FROM events WHERE e_id = ".$event_id;$e1_result = mysql_query($e1_query, $link) or die("Cannot return events");// query for events attendance$ea_query = "SELECT * FROM events_attend WHERE ea_event_id =".$event_id;$ea_result = mysql_query($ea_query, $link) or die("Cannot return members from events_attend"); I never close the connection with the mysql function could this be causing some problems? There is 4 events being display on the page and 4 buttons to execute the ajax query for each event. Does this have something to do with how many limit of queries I can make at one time? I restart my XAMPP and broswers sometimes it fixes it but then eventually comes back. Theres probably too many variables here to pin point whats exactly wrong. double /sigh Update again: Ok I checked it again today without changing the code. It works thanks alot Truefusion for your help. It does now and then get stuck in loading phase under safari and firefox so I guess its something to do with my server I mean if it works then it works but it lagging out shouldnt be from the code right? Well Im going to carry on using the protoype.js Framework for now to build the rest of the site.
-
Yeah I dont mind using a frame work. I did try the examples on that website with prototype.js but somehow I wasnt getting anything to work Im sure my path references was right I dont know what else it could be. So eventualy i came across the ext framework and starting going over the tutorials there it worked right away. If you get a working example of something similar i could use I will thanks.
-
this.http.onreadystatechange = handleUserslist(event_id); this.http.send(null); } function handleUsersliste(event_id) { if (this.http.readyState == 4) { this.response = this.http.responseText; document.getElementById('event_cpb_'+event_id).innerHTML = this.response; } } linenums:0'>function add_on_time(event_id) { this.http = createRequestObject(); this.http.open('get', 'includes/_events_locked_add_on_time.php?event_id='+event_id); this.http.onreadystatechange = handleUserslist(event_id); this.http.send(null);} function handleUsersliste(event_id) { if (this.http.readyState == 4) { this.response = this.http.responseText; document.getElementById('event_cpb_'+event_id).innerHTML = this.response; }} I changed the code to this. It stops working under safari with this version and firefox wont work either. I been browsering the net and found this link http://forums.xisto.com/no_longer_exists/ I think this maybe what i'm looking for Im looking into it now. Update: after looking at the example there and trying it out with no luck Im still at a lose. Found alot of Ajax frameworks out there but after some reading with most of the material going over my head lol Oh well Im not going to give up.
-
Thanks for your response. As for the example I was working off it works for a single query(request). What I am trying to do with my version is have a single fuction where I can pass a parameter to it e.g. 'event_id' So I could reuse the function for multiple buttons on my page if that makes any sense. The version i am working on works under safari and i was able to make queries and request for different parts of my page and did get a result. It is obviously not correct since It wont work on other broswers. Does anyone have an example of an Ajax request where you can reuse one function to request different results depending on the parameter being passed?
-
I did a tutorial on ajax started to write my own It was all working well under safari but when i tried to test it out on other broswers it doesnt seem to work at all. I've spend a few hours already going over it and cant seem to figure it out at this stage. Heres the code that works under safari function createRequestObject(){ var request_o; //declare the variable to hold the object. var browser = navigator.appName; //find the browser name if(browser == "Microsoft Internet Explorer"){ /* Create the object using MSIE's method */ request_o = new ActiveXObject("Microsoft.XMLHTTP"); }else{ /* Create the object using other browser's method */ request_o = new XMLHttpRequest(); } return request_o; //return the object}function add_on_time(event_id) { http = createRequestObject(); this.http.open('get', 'includes/_events_locked_add_on_time.php?event_id='+event_id); this.http.onreadystatechange = handleUserslist; this.http.send(null); function handleUserslist() { if (this.http.readyState == 4) { response = this.http.responseText; document.getElementById('event_cpb_'+event_id).innerHTML = this.response; } }} Theres the example I been learning off function createRequestObject(){ var request_o; //declare the variable to hold the object. var browser = navigator.appName; //find the browser name if(browser == "Microsoft Internet Explorer"){ request_o = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_o = new XMLHttpRequest(); } return request_o; }var http = createRequestObject(); function getProducts(){ http.open('get', 'internal_request.php?action=get_products&id=' + document.form_category_select.select_category_select.selectedIndex); http.onreadystatechange = handleProducts; http.send(null);}function handleProducts(){ if(http.readyState == 4){ //Finished loading the response var response = http.responseText; document.getElementById('product_cage').innerHTML = response; }} I got a question about the handleProducts() when its been called inside the getProducts() it doesnt use the '(' ')' why is that? I've tried to include them to pass paramaters but it wont work. e.g. I define my function handleProducts(parm1) then call it inside http.onreadystatechange = handleProducts(parm1);
-
Pretty cool idea there. Im looking forward to seeing the final result.
-
Graphical Gaming?! In some games you see those......
sonesay replied to ewcreators's topic in Programming
I dont know the exact code to do it but I think its done by using an image of what ever you want the bar to look like and then applying a width % value to it. Thats how some voting bars are made so i guess you can use it for representing anything else you like as well.so say you want to represent 50% hp you could have an image the side 50 pixels wide have a width value of 50% then it would be halfed to 25 pixels when displayed.<img src='imagebar.gif' width='"<?php echo $hp_level ?>"'$hp_level should = number+percent symbol (50%). -
Just an update. I guess the problem seems to be my function modechange() somehow not working with the openFormWindow(). I dont know if its because the very first page (Not Page A thats events_locked.php) only sends 1 post variable (event_id) so the function loop in page A for post dosent include 'mode' somehow. Well my current porblem now is I need to be able to set the <input type='hidden' name='mode' value so I can control what gets displayed on attendance.php (Page . My modechange() does alert me that its changed but when page B gets created its not set and somehow always defaults to mode='add_on_time' value no matter what button I push on page A (add on time button or add late button). Heres an image it might give a clear idea of what im trying to do. If i can control the 'mode' to = 'add_late' I can set the default time to current time. Edit: I spend the day reading up on abit of ajax and found an easy example. I backed up the files at this current stage since I still cant get it to work and am going to try to do it without using a pop up window. I think keeping it simple and working on the same page will see the site get done quicker. I can always go back to it and try get a working version of a pop up window at a later date.
-
Yes thats right I'll give that a go now thanks ^^Update:I've tried adding those line of code it seems to work but somehow the mode variable gets stuck and cannot be changed. It gets set to 'add_on_time' on the URL for 'mode' even when I click the second button to invoke changemode('add_late'). I do get the alert in the function that tells me alert(document.forms.form1.mode.value) is set to 'add_late' but once the page gets created its still set mode='add_on_time'. I've tried to change $_POST to $_GET and $_REQUEST but still no luckScript from Page A <script LANGUAGE="JavaScript">window.name="main_index";function openFormWindow(){ OpenWindow=window.open("add_attendance.php?<?php$firstrun=true;foreach($_POST as $i => $data){ if($firstrun)$firstrun=false; else echo'&'; echo $i."=".$data;}?>", "newwin", "height=500, width=400,toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no");var x = getElementByName("form1");x.target="newwin";x.submit();}function modechange(action) {document.forms.form1.mode.value = action;alert(document.forms.form1.mode.value);openFormWindow();}</SCRIPT>php form echo "<form method='get' name='form1'>"; echo "<input type='hidden' name='event_id' value='".$e['e_id']."' />"; echo "<input type='hidden' name='mode' value='Default' />"; echo "<input type='submit' value='Add On Time' onclick=\"modechange('add_on_time');\" />"; echo "<input type='button' value='Add Late' onclick=\"modechange('add_late');\" />"; echo "<input type='button' value='Add End Time' onclick='openFormWindow();' />"; echo "<input type='button' value='Add Leave' onclick='openFormWindow();' />"; echo "</form>"; Script from Page B (testing output) Post count: <?php echo count($_POST) . " "; ?>Get count: <?php echo count($_GET) . " <br /> "; ?>Request count: <?php echo count($_REQUEST) . " <br /> "; ?>Request mode: <?php echo $_REQUEST['mode']. " <br /> "; ?>Post mode: <?php echo $_POST['mode']. " <br /> "; ?>Get mode: <?php echo $_GET['mode']. " <br /> "; ?> for some reason i still get the URL add_attendance.php?event_id=4&mode=add_on_time from using the first or second button. The changemode() does alert a new value is set to 'mode' but it still isnt saved on the newly open window. I have tried using sessions but since Javascript was used to make the page no session variables are available on the new window.UPDATE:Sessions seems to work now on window.open pages. It worked first time round then somehow i butched up my code and it stoped working. I messed it up so much I had to revert back to yesterdays backup. Well ima give it another go.
-
Hey Coolcat I had a look at your code and copy n pasted it to try out it has some syntax errors so it wouldnt work for me. I had to change a few things. <?php//Add the code in body tags$lottonum="lotto_num_here";$nument = $_REQUEST['nument'];$name = $_REQUEST['name'];if ($lottonum == $nument){echo "Thank you! You have won the grand prize! An email has been sent to notify the admins.";mail("email@here.com" , "Subject: Lottery Winner $name" , "$name has just won the lottery. Please update his profile.");}else{echo "<form method=\"post\"><input type=\"text\" value=\"".$name."\" name=\"name\" /><br /><input type=\"text\" value=\"".$nument."\" name=\"nument\" /><br /><input type=\"submit\" value=\"Submit\" /></form>";}?> I've never used $_REQUEST before but if you put qoutes around it wont work. The other thing is with the else statment I dont think you can do. When you want to print out values in PHP variables you have to use the $ sign. Its seperate from the strings and joined by . on each end. <?php....else {?> HTML CODE<?php}?> I hope that helps
-
I have 2 main pages Page A(events_locked.php) and Page B(add_attendance.php). Both are php files. Page A takes a post var from another page(not Page B ) and then used to query for displaying records in a mysql datase. This variable has set as a session variable because there is 1 <input type='submit' on Page A that will invoke a javascript function to open a new window. <script LANGUAGE="JavaScript">window.name="main_index";function openFormWindow(){ OpenWindow=window.open("add_attendance.php", "newwin", "height=250, width=400,toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no");var x = getElementByName("form1");x.target="newwin";x.submit();} As you can see the first parameter on openFormWindow() is Page B php file Im wanting to display. The php file has some database queries in it and uses that preivous set session var to identify what records i want. When I use the window.open() from javascript it creates a nice new window for me but I cannot assign any <input type='hidden' values in it. I am going to be using 2 or more buttons on Page A thats going to go to page B and i need to be able to able to identify what is being submitted to display correct content for the user. The post count on page B is 0 so there is no way I am able to grab them. heres the code for page B it might help in understanding what I am trying to do abit better. $s['ea_added_group'] = false; // get list of members $m_query = "SELECT userid, username FROM users WHERE userid NOT IN (SELECT ea_user_id FROM events_attend WHERE ea_event_id =" . $event_id . ")"; $m_result = mysql_query($m_query, $link) or die("Cannot return users list"); // get event details $e_query = "SELECT * FROM events WHERE e_id = " . $event_id; $e_result = mysql_query($e_query, $link); while ($e = mysql_fetch_array($e_result)) { $e_start = $e['e_start']; } if ($p['mode'] == "") { $e_start = date("H linenums:0'><?phpsession_start();// include database fileinclude("includes/database_itrap.php");$event_id = $s['event_id'];$s['ea_added_group'] = false;// get list of members $m_query = "SELECT userid, username FROM users WHERE userid NOT IN (SELECT ea_user_id FROM events_attend WHERE ea_event_id =" . $event_id . ")";$m_result = mysql_query($m_query, $link) or die("Cannot return users list");// get event details$e_query = "SELECT * FROM events WHERE e_id = " . $event_id;$e_result = mysql_query($e_query, $link);while ($e = mysql_fetch_array($e_result)) { $e_start = $e['e_start'];}if ($p['mode'] == "") { $e_start = date("H:i:s");}?><html><head><title>Add Attendance</title><script type='text/javascript'>function addUser(toGroup,fromGroup) { var listLength = document.getElementById(toGroup).length; var selItem = document.getElementById(fromGroup).selectedIndex; var selText = document.getElementById(fromGroup).options[selItem].text; var selValue = document.getElementById(fromGroup).options[selItem].value; var i; var newItem = true; for (i = 0; i < listLength; i++) { if (document.getElementById(toGroup).options.text == selText) { newItem = false; break; } } if (newItem) { document.getElementById(toGroup).options[listLength] = new Option(selText, selValue); document.getElementById(fromGroup).options[selItem] = null; }}function saveGroup() { var strValues = ""; var boxLength = document.getElementById('group2').length; var elcount = 0; if (boxLength != 0) { for (i = 0; i < boxLength; i++) { if (elcount == 0) { strValues = document.getElementById('group2').options.value; } else { strValues = strValues + "," + document.getElementById('group2').options.value; } elcount++; } } if (strValues.length == 0) { return false; } else { document.forms['groupsform'].group_users.value = strValues; document.forms['groupsform'].submit(); return true; }}function ckForm() { var tmp = saveGroup(); return tmp;}function test () { alert(document.forms.groupsform.mode.value);}</script></head><body onLoad="test();"><form name="groupsform" method="post" action="events_locked.php" target="main_index" onSubmit="setTimeout('window.close()', 0000); return ckForm();"> <div align="center">Event ID: <?php echo $event_id . " "; ?>Start Time: <input type="text" name="ea_start" value="<?php echo $e_start; ?>" size="10" /><br /><select multiple='multiple' size='10' id='group1' name='group1' style='width:150' onChange="addUser('group2','group1');" ><?phpwhile($u = mysql_fetch_array($m_result)) { echo "<option value='" . $u['userid'] . "'>" . ucfirst($u['username']) . "</option>";}?></select><select multiple='multiple' size='10' id='group2' name='group2' style='width:150' onChange="addUser('group1','group2');" ></select><input type='hidden' name='group_users' /><input type="hidden" name="event_id" value="<?php echo $event_id; ?>" /><input type="hidden" name="mode" value="" /><input type="submit" name="save_group" value="submit form" /> <input type="submit" value="Close" onClick="window.close();" /><br /><br />Post count: <?php echo count($_POST); ?>Mode: <?php echo $_POST['mode']; ?></div></form></body></html> I seem to be posting alot of issues with how I want to do things in web. I have read/seen abit of ajax but still not proficent in PHP, XHTML, or JS enough to want to dive into it at this stage. Im still only starting to understand the DOM. I look on the web for any examples to help but there is nothing close to what I want to do so far. I sometimes wonder am I going about this the wrong way. sorry for the rant please someone help me out.
-
Hi all. I am trying to make a list out of 2 list. The first list is a complete list of users id from users table (List A) The Second list is of users id from another table (List :PI want to subtrack the user ids in List B from List A and make List C.Thanks in advance for any help :)Update: I looked up a old sql book i had and found some query examples. I tried the EXCEPT statement in mysql but it dont work so used another example. SELECT userid, usernameFROM usersWHERE userid NOT IN (SELECT ea_user_idFROM events_attend) Good thing Mysql can do it I was dreading the idea of having to do this in php arrays.
-
First off im not sure if it goes in PHP or xhtml section this code deals with both. I have 2 pages there is a button on the first that opens a new window and displays 2 select forms. Once selections have been made when you submit it gets submited to first main window and the second window is closed. Im having trouble trying to grab the selected options. note: the output of the options are from my database so maybe you can fill them with dummy options when you do testing. groups_index.php echo $_POST['group2']; } ?> linenums:0'><script LANGUAGE="JavaScript">window.name="main_index";function openFormWindow(){ OpenWindow=window.open("groups.php", "newwin", "height=250, width=400,toolbar=no,scrollbars=no,menubar=no,location=no, resizable=no");}</SCRIPT><input type="button" onclick="openFormWindow();" value="Open Form" /><?phpif (isset($_POST['group2'])) { echo $_POST['group2'];}?> groups.php function addUser(toGroup,fromGroup) { var listLength = document.getElementById(toGroup).length; var selItem = document.getElementById(fromGroup).selectedIndex; var selText = document.getElementById(fromGroup).options[selItem].text; var selValue = document.getElementById(fromGroup).options[selItem].value; var i; var newItem = true; for (i = 0; i < listLength; i++) { if (document.getElementById(toGroup).options.text == selText) { newItem = false; break; } } if (newItem) { document.getElementById(toGroup).options[listLength] = new Option(selText, selValue); document.getElementById(fromGroup).options[selItem] = null; } } function saveGroup() { var strValues = ""; var boxLength = document.getElementById('grouplist2').length; var elcount = 0; if (boxLength != 0) { for (i = 0; i < boxLength; i++) { if (elcount == 0) { strValues = document.getElementById('grouplist2').options.value; } else { strValues = strValues + "." + document.getElementById('grouplist2').options.value; } elcount++; } } if (strValues.length == 0) { document.forms['groupsform'].submit(); } else { document.forms['groupsform'].group_users.value = strValues; document.forms['groupsform'].submit(); } } </script> <form name="groupsform" method="post" action="groups_index.php" target="main_index" onsubmit="setTimeout('window.close()',1000)"> <div align="center"> <select multiple='multiple' size='10' id='group1' name='group1' style='width linenums:150'><?php// include database fileinclude("../includes/database_itrap.php");// get list of members $m_query = "SELECT userid, username FROM users";$m_result = mysql_query($m_query, $link) or die("Cannot return users list");?><script type='text/javascript'>function addUser(toGroup,fromGroup) { var listLength = document.getElementById(toGroup).length; var selItem = document.getElementById(fromGroup).selectedIndex; var selText = document.getElementById(fromGroup).options[selItem].text; var selValue = document.getElementById(fromGroup).options[selItem].value; var i; var newItem = true; for (i = 0; i < listLength; i++) { if (document.getElementById(toGroup).options.text == selText) { newItem = false; break; } } if (newItem) { document.getElementById(toGroup).options[listLength] = new Option(selText, selValue); document.getElementById(fromGroup).options[selItem] = null; }}function saveGroup() { var strValues = ""; var boxLength = document.getElementById('grouplist2').length; var elcount = 0; if (boxLength != 0) { for (i = 0; i < boxLength; i++) { if (elcount == 0) { strValues = document.getElementById('grouplist2').options.value; } else { strValues = strValues + "." + document.getElementById('grouplist2').options.value; } elcount++; } } if (strValues.length == 0) { document.forms['groupsform'].submit(); } else { document.forms['groupsform'].group_users.value = strValues; document.forms['groupsform'].submit(); }}</script><form name="groupsform" method="post" action="groups_index.php" target="main_index" onsubmit="setTimeout('window.close()',1000)"> <div align="center"><select multiple='multiple' size='10' id='group1' name='group1' style='width:150' onchange="addUser('group2','group1');" ><?phpwhile($u = mysql_fetch_array($m_result)) { echo "<option value='" . $u['userid'] . "'>" . ucfirst($u['username']) . "</option>";}?></select><select multiple='multiple' size='10' id='group2' name='group2' style='width:150' onchange="addUser('group1','group2');" ></select><input type="submit" value="submit form" onclick="saveGroup();"/> <input type="submit" value="Close" onclick="window.close();" /></div></form> update: sorry guys i didnt change the saveGroup() it was refering to the old name grouplist2. I changed it now and its work so far. Well hopefully someone will find this useful.
-
You need to know a few things first before you can start connecting to a mysql database. host, username, password, database name. Once you know that you can set it up with the code below and if all is correct you can execute queries with mysql_query("query goes here", $link); There should be plenty of examples out there just do a search. <?php $db_host = 'localhost'; $db_user = ''; $db_pass = ''; $db_name = ''; // if user has submitted anything then validate. $link = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect to Database > ". $db_name); mysql_select_db($db_name,$link) or die("Could not find Database > ". $db_name);?>
-
Very Simple Online Now Script This is a very simple online now script.
sonesay replied to ewcreators's topic in Programming
could you show a full description of onlinenow table please? Im abit confused about hows its setup. -
How would the email look from the recievers end? I mean would they see the return address of the email something linke yourusername@Xisto.com?