Jump to content

CMellor

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

About CMellor

  • Birthday 05/02/1985

Contact Methods

  • MSN
    cmellor@gmail.com
  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Leeds, UK

CMellor's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello all, First I'd like to point out that I'm new-ish to Javascript, I don't use it in big chunks, just small. I have made this function, check it out: function callPage(url) { Spry.Utils.setInnerHTML('blah', 'Loading...'); Spry.Utils.loadURL("GET", url, true, callHandle); } function callHandle(req) { Spry.Utils.setInnerHTML('blah', req.xhRequest.responseText); } I use an onClick with a Button to call it: <input name="button" type="button" onclick="callPage('spry_form.php?id=14');" value="Click" /> and the requested text appears here: <div id="blah"></div> I want to use this function more than once and would want to call a new DIV ID each time, but when I try this function: function callPage(url, div) { Spry.Utils.setInnerHTML(div, 'Loading...'); Spry.Utils.loadURL("GET", url, true, callHandle); } function callHandle(req) { Spry.Utils.setInnerHTML(div, req.xhRequest.responseText); } Along with this XHTML: <input name="button" type="button" onclick="callPage('spry_form.php?id=14', 'blah');" value="Click" /> When I click the button, it shows the 'Loading...' text, but doesn't request the file, it just says 'Loading...' all the time. As I stated I'm new-ish with Javascript and not sure what I may have done wrong with this function. If anybody can guide me in the right direction, I would be greatly appreciated, and it would help me a lot! Thanks for taking the time to read, and I look forward to a response, Chris.
  2. Hello, I have been trying to develop a bit of code to allow me to update a database field when an onChange occures on a drop down box. For some odd reason, it doesn't work at all, also I might add I am using Prototype. Here's my code: <script language="Javascript" type="text/javascript"> // Update roster brand function changeBrand(value, id) { new Ajax.Updater('div', 'js/brand.php?show=' + value + '&id=' + id); } </script> <?php // MySQL connect include('../../include/functions.php'); // connect connect(); if(!isset($_GET['show'])) { mysql_query("UPDATE ibf_members SET mgroup = '".$_GET['show']."' WHERE id = '".$_GET['id']."'"); } // close MySQL mysql_close(); ?> echo(' <form action="" method="post" name="form"> <select name="brand" onchange="changeBrand(document.form.brand.options[document.form.brand.selectedIndex].value, '.$row['id'].'); return false"> '); // query $group_query = mysql_query("SELECT * FROM ibf_groups, ibf_members WHERE ibf_groups.g_id = ibf_members.id AND g_id IN(3, 4, 6, 7)"); // fetch data while($groups = mysql_fetch_array($group_query)) { $selected = $row['mgroup'] == $groups['g_id'] ? 'selected' : ''; echo(' <option value="'.$groups['g_id'].'" '.$selected.'>'.$groups['g_title'].'</option> '); } echo(' </select> </form> <div id="div"></div> '); Does anything look wrong?
  3. Note, tried editing my last post but it wouldn't let me. Nevermind, figured it out *finally* If interested, here's the code: <select name="brand"> // query $group_query = mysql_query("SELECT * FROM ibf_groups, ibf_members WHERE ibf_groups.g_id = ibf_members.id AND g_id IN(3, 4, 6, 7)"); // fetch data while($groups = mysql_fetch_array($group_query)) { $selected = $row['mgroup'] == $groups['g_id'] ? 'selected' : ''; echo(' <option value="'.$groups['g_id'].'" '.$selected.'>'.$groups['g_title'].'</option> '); } </select> I just used a different query. Thanks for the help though Barand!
  4. Hmmm... am assuming you mean these, their pretty long: -- -- Table structure for table `ibf_groups` -- CREATE TABLE `ibf_groups` ( `g_id` int(3) unsigned NOT NULL auto_increment, `g_view_board` tinyint(1) default NULL, `g_mem_info` tinyint(1) default NULL, `g_other_topics` tinyint(1) default NULL, `g_use_search` tinyint(1) default NULL, `g_email_friend` tinyint(1) default NULL, `g_invite_friend` tinyint(1) default NULL, `g_edit_profile` tinyint(1) default NULL, `g_post_new_topics` tinyint(1) default NULL, `g_reply_own_topics` tinyint(1) default NULL, `g_reply_other_topics` tinyint(1) default NULL, `g_edit_posts` tinyint(1) default NULL, `g_delete_own_posts` tinyint(1) default NULL, `g_open_close_posts` tinyint(1) default NULL, `g_delete_own_topics` tinyint(1) default NULL, `g_post_polls` tinyint(1) default NULL, `g_vote_polls` tinyint(1) default NULL, `g_use_pm` tinyint(1) default '0', `g_is_supmod` tinyint(1) default NULL, `g_access_cp` tinyint(1) default NULL, `g_title` varchar(32) NOT NULL default '', `g_can_remove` tinyint(1) default NULL, `g_append_edit` tinyint(1) default NULL, `g_access_offline` tinyint(1) default NULL, `g_avoid_q` tinyint(1) default NULL, `g_avoid_flood` tinyint(1) default NULL, `g_icon` text NOT NULL, `g_attach_max` bigint(20) default NULL, `g_avatar_upload` tinyint(1) default '0', `prefix` varchar(250) default NULL, `suffix` varchar(250) default NULL, `g_max_messages` int(5) default '50', `g_max_mass_pm` int(5) default '0', `g_search_flood` mediumint(6) default '20', `g_edit_cutoff` int(10) default '0', `g_promotion` varchar(10) default '-1&-1', `g_hide_from_list` tinyint(1) default '0', `g_post_closed` tinyint(1) default '0', `g_perm_id` varchar(255) NOT NULL default '', `g_photo_max_vars` varchar(200) default '100:150:150', `g_dohtml` tinyint(1) NOT NULL default '0', `g_edit_topic` tinyint(1) NOT NULL default '0', `g_email_limit` varchar(15) NOT NULL default '10:15', `g_bypass_badwords` tinyint(1) NOT NULL default '0', `g_can_msg_attach` tinyint(1) NOT NULL default '0', `g_attach_per_post` int(10) NOT NULL default '0', `g_topic_rate_setting` smallint(2) NOT NULL default '0', `g_dname_changes` int(3) NOT NULL default '0', `g_dname_date` int(5) NOT NULL default '0', `g_blog_attach_max` int(10) NOT NULL default '-1', `g_blog_attach_per_entry` int(10) NOT NULL default '0', `g_blog_do_html` tinyint(1) NOT NULL default '0', `g_blog_do_commenthtml` tinyint(1) NOT NULL default '0', `g_blog_allowpoll` tinyint(1) NOT NULL default '0', `g_blog_allowprivate` tinyint(1) NOT NULL default '0', `g_blog_allowprivclub` tinyint(1) NOT NULL default '0', `g_blog_alloweditors` tinyint(1) NOT NULL default '0', `g_blog_allowskinchoose` tinyint(1) NOT NULL default '0', `g_blog_preventpublish` tinyint(1) NOT NULL default '0', PRIMARY KEY (`g_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Table structure for table `ibf_members` -- CREATE TABLE `ibf_members` ( `id` mediumint( NOT NULL default '0', `name` varchar(255) NOT NULL default '', `mgroup` smallint(3) NOT NULL default '0', `email` varchar(150) NOT NULL default '', `joined` int(10) NOT NULL default '0', `ip_address` varchar(16) NOT NULL default '', `posts` mediumint(7) default '0', `title` varchar(64) default NULL, `allow_admin_mails` tinyint(1) default NULL, `time_offset` varchar(10) default NULL, `hide_email` varchar( default NULL, `email_pm` tinyint(1) default '1', `email_full` tinyint(1) default NULL, `skin` smallint(5) default NULL, `warn_level` int(10) default NULL, `warn_lastwarn` int(10) NOT NULL default '0', `language` varchar(32) default NULL, `last_post` int(10) default NULL, `restrict_post` varchar(100) NOT NULL default '0', `view_sigs` tinyint(1) default '1', `view_img` tinyint(1) default '1', `view_avs` tinyint(1) default '1', `view_pop` tinyint(1) default '1', `bday_day` int(2) default NULL, `bday_month` int(2) default NULL, `bday_year` int(4) default NULL, `new_msg` tinyint(2) default '0', `msg_total` smallint(5) default '0', `show_popup` tinyint(1) default '0', `misc` varchar(128) default NULL, `last_visit` int(10) default '0', `last_activity` int(10) default '0', `dst_in_use` tinyint(1) default '0', `view_prefs` varchar(64) default '-1&-1', `coppa_user` tinyint(1) default '0', `mod_posts` varchar(100) NOT NULL default '0', `auto_track` varchar(50) default '0', `temp_ban` varchar(100) default '0', `sub_end` int(10) NOT NULL default '0', `login_anonymous` char(3) NOT NULL default '0&0', `ignored_users` text NOT NULL, `mgroup_others` varchar(255) NOT NULL default '', `org_perm_id` varchar(255) NOT NULL default '', `member_login_key` varchar(32) NOT NULL default '', `member_login_key_expire` int(10) NOT NULL default '0', `subs_pkg_chosen` smallint(3) NOT NULL default '0', `has_blog` tinyint(1) NOT NULL default '0', `has_gallery` tinyint(1) NOT NULL default '0', `members_markers` text NOT NULL, `members_editor_choice` char(3) NOT NULL default 'std', `members_auto_dst` tinyint(1) NOT NULL default '1', `members_display_name` varchar(255) NOT NULL default '', `members_created_remote` tinyint(1) NOT NULL default '0', `members_cache` mediumtext, `members_disable_pm` int(1) NOT NULL default '0', `members_l_display_name` varchar(255) NOT NULL default '0', `members_l_username` varchar(255) NOT NULL default '0', `failed_logins` text, `failed_login_count` smallint(3) NOT NULL default '0', `members_profile_views` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `members_l_display_name` (`members_l_display_name`), KEY `members_l_username` (`members_l_username`), KEY `mgroup` (`mgroup`), KEY `bday_day` (`bday_day`), KEY `bday_month` (`bday_month`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  5. Hey, thanks for the reply, Sadly that didn't work the current selected option is the first one for each member. Any more help is appreciated. Chris.
  6. 'lo all, I come seeking help! lol I've been racking my brain and tried many codes to get this to work and can't seem to get close to how I want it. I am using the tables from Invision Power Board and made a drop down box with the list of user groups, but only limited it to show three of the groups instead of them all. The users are in different groups. I have a list of all my users and next to it is that drop down box listing the groups, now what I want is to have the correct group selected for that user, but I can't seem to manage that, so any help would be appreciated. Here's the code: <select name="brand"> '); // query $group_query = mysql_query("SELECT * FROM ibf_groups WHERE g_id = 3 OR g_id = 6 OR g_id = 7"); // fetch data while($groups = mysql_fetch_array($group_query)) { $_POST['mgroup'] == $groups['g_id'] ? $selected = 'selected' : $selected = ''; echo(' <option value="'.$groups['g_id'].'" '.$selected.'>'.$groups['g_title'].'</option> '); } echo(' </select> This is a snippet of the code. I thought adding the group ID to a hidden field could work, that's why theirs a $_POST var in that code. So hope I made sense and look forward to hearing from you. Chris.
  7. Hello all. I am trying to make a DIV stretch to the bottom of the page on a site I am doing for a friend. I have actually managed to do it, it looks good, but the problem is that the page scrolls down a lot, when theirs nothing their to scroll down for. Here is the website. As you can see, some unwanted scrolling occurs, which I would like rid of. Here is the code I have so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Red Alert Fire</title> <style type="text/css"> <!-- html, body { height: 100%; } #wrapper { width: 750px; margin-left: auto; margin-right: auto; } #header { background: url(header.gif); height: 200px; } .border-l, .border-r { background: url(border.gif) left repeat-y; position: absolute; height: 100%; width: 750px; } .border-r { background: url(border.gif) right repeat-y; } --> </style> </head> <body> <div id="wrapper"> <div id="header"> </div> <div class="border-l"> <div class="border-r"> </div> </div> </div> </body> </html> If anybody would be kind enough to have a look through it and maybe guide me in the right direction, I would be most grateful. Thanks for your time, Chris.
  8. Odd as this may sound, I have only just discovered the [b]strtotime()[/b] function. I like the looks of what it is capable of and have tried to use it to my advantage. I tried to make a little script that would convert a UNIX time stamp into a message saying whether or not the stamp was a time for today, or yesterday, or if neither, then just display the date it is. I'm not a PHP pro, but am always learning. I have looked all over for tutorials on how to do this, but the only useful one's I found are for blogging software. I was hoping someone here could guide me in the right direction of where to begin coding this script, or maybe provide me with a sample that I can toy around with myself. Any help at all would be appreciated. Thanks for reading, Chris.
  9. Hello, I am stuck, as I am in the need for a very simple way to validate e-mail address' when a form has been submitted. My form is using AJAX to submit the form, and when a field is missed out, an alert() appears with the error. Here is my code for reference: [code]function sendAppForm() { // Error checking // Display Name if(document.app_form.display_name.value == "") { alert("Please choose a superstar!"); document.app_form.display_name.focus(); return; } if(document.app_form.display_name.value.length < 3 || document.app_form.display_name.value.length > 32) { alert("Your selected superstar has a too short or long name"); document.app_form.display_name.focus(); return; } // Username if(document.app_form.username.value == "") { alert("Please choose a username"); document.app_form.username.focus(); return; } if(document.app_form.username.value.length < 3 || document.app_form.username.value.length > 32) { alert("Your selected username has a too short or long name"); document.app_form.username.focus(); return; } // Password if(document.app_form.password.value == "") { alert("Please choose a password"); document.app_form.password.focus(); return; } if(document.app_form.password.value.length < 3 || document.app_form.password.value.length > 32) { alert("Your selected password has a too short or long name"); document.app_form.password.focus(); return; } // E-Mail // Role Play if(document.app_form.roleplay.value == "") { alert("You MUST provide a Role Play!"); return; } ajax.open('POST', 'ajax/send_app.php'); ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajax.onreadystatechange = function() { if(ajax.readyState == 4 && ajax.status == 200) { document.getElementById("appForm").innerHTML = ajax.responseText; } }; ajax.send('superstar='+document.app_form.display_name.value); }[/code] I've tried a few bits of code, and they do actually validate the e-mail when it's not inserted correctly, but when it is and I try to submit the form, well it just won't submit. Any help would be greatly appreciated! Thanks! Chris.
  10. Awesome, thanks for the quick response. I knew it was a simple code. Shame I can't see to make it work, but that's because I'm testing on my Localhost, so when I try it, it just comes up with "Page cannot be displayed" Ah well, I guess I'll have to wait until I have my web host set up. Thanks again.
  11. Hey, I was hoping you could help me; I am on the search for a bit of code that can tell me if another website on the internet is up and active, or non existent. I know it exists, as I've seen it before, but I can't find anything and I can't find the right keywords to use when searching for it. If anybody knows of such a code, could you direct it to me please? Thanks so much, Chris.
  12. Thank you guys for your code example's, they are really helpful! Could I direct you to this code which is modified to what sasa provided for me. [code]<?php $usernames = array("chris", "bob", "pete"); $passwords = array("piss", "knob", "feet"); $login = "The supplied username and/or password we're incorrect."; for($x = 0; $x < count($usernames); $x++) { if(@$username == $usernames[$x] && $password == $passwords[$x]): $query = mysql_query("SELECT id, name FROM $dbname.app_roster ORDER BY name ASC") or die(mysql_error()); while($row = mysql_fetch_array($query)) { $login =  $row['name'].'<br />'; } endif; } echo $login; ?>[/code] Notice how I am using a [b]mysql_query()[/b] to grab some data from the datasbase? Here is my situation: When correctly logged in, the big list of name's will show up, but underneath the list of name's, it will also say [i]The supplied username and/or password we're incorrect.[/i] which is the error message if a login is incorrect, yet still displays underneath the SQL results. I've tried all sort's of way's to try and solve this but have got nowhere. Hopefully somebody can solve my problem and I hope I am not becoming too much of a fuss, I just want to learn and this is a great place to do it! Thank you again for taking the time to help. Chris.
  13. Nice bit of code their and yes it does work... kind of. I have made this code my own, like so: [code]<?php $usernames = array("chris", "bob", "pete"); $passwords = array("piss", "knob", "feet"); for($x = 0; $x < count($usernames); $x++) { if(@$username == $usernames[$x] && $password == $passwords[$x]): echo("logged in"); else: echo("not logged in"); endif; } ?>[/code] Now when I try to login with say, pete > feet. It comes up like so: [i]not loggedinnot logged innot logged in[/i] which means it didn't work, and it also says that when I put the wrong details in. Do you have any advice on this? Thanks for taking the time to help me out, I really appreciate it.
×
×
  • 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.