Jump to content

MikeFairbrother

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MikeFairbrother's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Guys, I was wondering if anyone can help me. I have a perfectly working registration script, however I want to modify it slightly to 1. Remove spaces in usernames. 2. Block characters like éá 3. Block a set list of usernames.. Basically, the space issue because some people are registering Something Something...and it causes problems with different parts of the system.... The list of usernames, if they have entered a username in the list I set, then it will say it's been filtered and not allow them to register it. Note: I could enter "Mike" and it would block all cases like MiKe, mIKE, mIkE and MIKE etc... I did originally use: [code] $usernames = array('Mike', 'Dave', 'Admin', 'Manager', 'Owner'); if (!in_array(@eregi($_REQUEST['username']), $usernames)) {[/code] But that was hashed out as it wouldent work...[A friend of mine provided me with this, but was busy at the time and didn't want to bother him with problems] $_REQUEST['username'] That's the request used... I thank everyone for their help! Muchos Grasias
  2. not quiet sure what you mean, ellaborate? However, wouldent it be easier to have a 'menu' database, then inside that, tables for each meal. Then it would be [code]<?php if ($_GET['act'] == 'sushi') { $getList = mysql_query("SELECT `id`, `description`, `pricing` FROM `menu` WHERE id=5") or die('Could not connect to the database!');[/code] id=5 because this was what the id for sushi is... alternatively, you could have it so its like [code] if ($_GET['act'] == 'soups'){ $id = 1 } elseif ($_GET['act'] == 'salads'){ $id = 2 } elseif ($_GET['act'] == 'appetizers'){ $id = 3 } elseif ($_GET['act'] == 'entrees'){ $id = 4 } elseif ($_GET['act'] == 'sushi'){ $id = 5 } elseif ($_GET['act'] == 'a la carte'){ $id = 6 } elseif ($_GET['act'] == 'dessert'){ $id = 7 } elseif ($_GET['act'] == 'beverages'){ $id = 8 } $getList = mysql_query("SELECT `id`, `description`, `pricing` FROM `menu` WHERE id=$id") or die('Could not connect to the database!'); [/code] You could implement the above into some sort of selection, so you would have a hyperlink for each dish/food item, which would then display whatever you selected, all in one file <a href="menu.php?select=sushi">Sushi</a> <a href="menu.php?select=salad">Salad</a> Then change the above respectively: [code]if ($select == 'sushi'){ $id = 5 }[/code] Hope this helps...sorry if its not what you wanted :)
  3. [code]if((((($_REQUEST['who'] == 1) || ($_REQUEST['who'] == 2) || ($_REQUEST['who'] == 3) || ($_REQUEST['who'] == 4) || ($_REQUEST['who'] == 5))))){ $num = mysql_num_rows(mysql_query("SELECT * FROM staff where level='".$_REQUEST['who']."'")); $row = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='".$_REQUEST['who']."'")); mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row['username']."\",\"".$_REQUEST['msg_from']."\")");    }    echo 'Your message has been sent to '.$num.' users.<p><a href="privmsgs.php">Go Back to Inbox</a>';[/code] It echos how many people it "should" have been sent too, but dosent actually send/input into database... (Sorry for double post)
  4. Below - sorry I wanted to delete this post but can't :)
  5. Is it set to be from a specific place, like from system@system.com.. Post your coding? Maybe Norton is also blocking it as recognised/potential SPAM?
  6. "why not just change the code back :S" I'd rather not change it back, it's like 5 lines of coding when you only really need one. It's a very big file, the whole PM system runs off the one privmsgs.php file and im trying to making it just as efficient, with un-needed coding. They both work in exactly the same way; its just for some reason, it isnt processing correctly.
  7. Hi Guys, Ok, I'm probably missing something really small, but I basically have a small personal message system for my website admin area. I'm just recoding it and things; and tidying up the code, but i've hit a problem. I've got this: [code] if((((($_REQUEST['who'] == 1) || ($_REQUEST['who'] == 2) || ($_REQUEST['who'] == 3) || ($_REQUEST['who'] == 4) || ($_REQUEST['who'] == 5))))){ $num = mysql_num_rows(mysql_query("SELECT * FROM staff where level='".$_REQUEST['who']."'")); $row = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='".$_REQUEST['who']."'")); mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row['username']."\",\"".$_REQUEST['msg_from']."\")");    }    echo 'Your message has been sent to '.$num.' users.<p><a href="privmsgs.php">Go Back to Inbox</a>';      }elseif(((($_REQUEST['who'] == UK) || ($_REQUEST['who'] == US) || ($_REQUEST['who'] == CA) || ($_REQUEST['who'] == AU)))){ $num = mysql_num_rows(mysql_query("SELECT * FROM staff where hotel='".$_REQUEST['who']."'")); $row = mysql_fetch_array(mysql_query("SELECT * FROM staff where hotel='".$_REQUEST['who']."'")){   mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row['username']."\",\"".$_REQUEST['msg_from']."\")");    }    echo 'Your message has been sent to '.$num.' users.<p><a href="privmsgs.php">Go Back to Inbox</a>';    }elseif($_REQUEST['who'] == 0){ $num1 = mysql_num_rows(mysql_query("SELECT * FROM staff where level='1'")); $num2 = mysql_num_rows(mysql_query("SELECT * FROM staff where level='2'")); $num3 = mysql_num_rows(mysql_query("SELECT * FROM staff where level='3'")); $num4 = mysql_num_rows(mysql_query("SELECT * FROM staff where level='4'")); $row1 = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='1'")){   mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row1['username']."\",\"".$_REQUEST['msg_from']."\")"); } $row2 = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='2'")){   mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row2['username']."\",\"".$_REQUEST['msg_from']."\")"); } $row3 = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='3'")){   mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row3['username']."\",\"".$_REQUEST['msg_from']."\")"); } $row4 = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='4'")){ mysql_query("INSERT INTO privmsgs (msg_title, msg_txt, msg_read, msg_date, msg_time, msg_ip, msg_to, msg_from) VALUES(\"".$_REQUEST['subject']."\",\"".nl2br($_REQUEST['message'])."\",\"0\",\"".date('j-m-Y')."\",\"".time()."\",\"".$_SERVER['REMOTE_ADDR']."\",\"".$row4['username']."\",\"".$_REQUEST['msg_from']."\")"); } $num = $num1 + $num2 + $num3 + $num4; echo 'Your message has been sent to '.$num.' users.<p><a href="privmsgs.php">Go Back to Inbox</a>'; } [/code] Basically, it all used to work, untill I changed [code] $sql = "SELECT * FROM staff where level='".$_REQUEST['who']."'"; $result = mysql_query($sql); $num = mysql_num_rows($result); while($row = mysql_fetch_array($result)){[/code] To this: [code] $num = mysql_num_rows(mysql_query("SELECT * FROM staff where level='".$_REQUEST['who']."'")); $row = mysql_fetch_array(mysql_query("SELECT * FROM staff where level='".$_REQUEST['who']."'"));[/code] I think there may be something wrong with that. Apart from that, everything else seems to work :) Any help is appreciated. THANKS in advance, Mike
×
×
  • 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.