Jump to content

marksie1988

Members
  • Posts

    225
  • Joined

  • Last visited

Everything posted by marksie1988

  1. when you have run this script once it creates the database correct? so this would then mean that ie cannot create the database as it is already there so it will just fail like it has done there, firefox may just be skipping the step. i would sugest deleting the table and then trying it in IE unless you have already done that. also it could maybe be caused by the fact you have 2 different $sql variables this may be causing a clash maybe change one to $sql1
  2. i am not sure how you would be able to do this, but i have just been looking into the same type of thing and apparently programs that send the newsletter type emails can lower the rating so may be worth looking at that
  3. wouldnt it be simpler for you to put the mobile phones and the simcard in the same table? seems daft having them seperate unless there is a reason this would probably make your problems easier to solve
  4. it will be something that mozilla supports that ie doesnt i have noticed things like this before ie needs the code to be spot on for it to work where as firefox can handle minor errors in certain codes e.g. forms, i noticed this when i was building a website in firefox but the person it was for used IE chances are you will never get it to work perfectly in both browsers
  5. it will be getting picked up as spam but the rating will be so high that people like yahoo etc will not even put it into the inbox for stuff like that you are better off using a program for this sorta stuff
  6. oo well spotted hehe unfortunatly the way that my page code works i will have to do the query's seperatley i was trying to do it as one but it messes up my page as its mainly html
  7. i have some code which displays information from a table as links, the links are split up into categories and then should all be displayed under their category but for some reason i can only get it to display one row not all rows please help :S <?php $query = "SELECT * FROM links ORDER BY title"; $result = mysql_query ($query); while ($row = mysql_fetch_assoc ($result)) { $category = html_entity_decode($row['category']); $link = html_entity_decode($row['link']); $title = html_entity_decode($row['title']); $desc = html_entity_decode($row['description']); } if($caregory == music){ echo"<a href='$link' title='$desc' target='_blank'>$title</a>"; } else{ echo"There are no links"; } ?>
  8. oops sorry i solved this a while back but forgot to solve it :S sorry fella
  9. ok so i got it to work but i want a popup to appear when a link is clicked so that when a user confirms the delete it will run an sql to delete that row. i havent used javascript with php before so this is a first time for me i would like a javascript popup confirm box to go where the echo "working"; part is. please help below is my current code. <?php if (isset($_GET['id'])){ echo "Working"; } else{ $query="select * from band ORDER BY name"; $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ echo "<a href='../../../admin/del/bandm/index.tcos?id=".$nt[id]."'>$nt[name]</a><br>"; } } ?>
  10. oh i didnt realise you could use the get function for this i will try it out when i get home tonight
  11. i have a script which displays information from a mysql table (index.tcos) and then creates a link using the rows id on clicking this link i want it to delete that row from the table so what i need is a way of saying if (isset(index.tcos?id=3)){ delete the row from the database } else{ $query="select * from band ORDER BY name"; $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ echo "<a href='../../../admin/del/bandm/index.tcos?id=".$nt[id]."'>$nt[name]</a><br>"; } } all i need is to know how i can get the information from the address bar, the ?id=3, and after geting this info it will run a mysql delete query on that row? i hope you understand what i would like to do, all i dont know is how to get the address from the address bar :S
  12. sorted it out now thanks for the help here is the code finished $dateOfBirth = $row['dob']; // Split the date of birth into an array $dateOfBirth = explode('-', $dateOfBirth); // create a timestamp of the users date of birth $dobTimestamp = mktime(0,0,0,$dateOfBirth['1'], $dateOfBirth['2'], $dateOfBirth['0']); // Subtract date of birth timestamp from the current time $ageinseconds = time() - $dobTimestamp; $days = $ageinseconds / 86400; $years = floor($days / 365); $days = $days % 365; then you just echo $years for the number of years and $days for the number of days
  13. this returns an age of minus look -594834538 is what was returned? fixed with this $ageInSeconds = time() - $dobTimestamp;
  14. i have the flowing table CREATE TABLE `band` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(50) NOT NULL, `pos` varchar(50) NOT NULL, `dob` date NOT NULL default '0001-01-01', `bio` text NOT NULL, `equip` text NOT NULL, `songw` text NOT NULL, `inf` text NOT NULL, `goals` text NOT NULL, `myspace` carchar(200) NOT NULL, `image` text NOT NULL, PRIMARY KEY (`id`) ) and i also have a page that displays the information but i want to display the dob (date of birth) column as the age of a person how do i do this? currently all i can get it to do is show todays date or the date from the table but i cant get it to show an age. Any ideas?
  15. a week thats a bit long isnt it i mean 24 hours is the norm haha thats how rubish it all is
  16. i need to know what i should record a dob as in mysql to then display it on a webpage with and age not dob so that the age auto updates? i know this is possible but i dont know how to do it. i have the line that i need for the mysql database just dont know how to tell php to convert it to an age `dob` date NOT NULL default '0001-01-01',
  17. thanks for your help in looking at this with a bit of fidling about andcode changing i got it to work now
  18. $article_id shows 0 so that is incorrect and when i do $_GET['id'] it doesnt display anything looks like this part is not correct for what i am trying to do. i need to send the id from the form to the adminprocess file somehow.
  19. ok ive fixed the problem now. i see what you mean about indenting correctly you can see where gaps are too big then here is the updated code and now what happens is that it doesnt get the article id to update the fields i can tell as it shows my error there are no songs with this article id <? /** * AdminProcess.php * * The AdminProcess class is meant to simplify the task of processing * admin submitted forms from the admin center, these deal with * member system adjustments. * * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) * Last Updated: August 15, 2004 */ include("include/session.tcos"); class AdminProcess { /* Class constructor */ function AdminProcess(){ global $session; /* Make sure administrator is accessing page */ if(!$session->isAdmin()){ header("Location: ../main.php"); return; } /* Admin submitted delete user form */ else if(isset($_POST['subdeluser'])){ $this->procDeleteUser(); } /* Admin submitted add news form */ else if(isset($_POST['subaddnews'])){ $this->procaddnews(); } /* Admin submitted delete news form */ else if(isset($_POST['subdelnews'])){ $this->procDeletenews(); } /* Admin submitted add song form */ else if(isset($_POST['subaddsong'])){ $this->procaddsong(); } /* Admin submitted edit song form */ else if(isset($_POST['subeditsong'])){ $this->proceditsong(); } /* Admin submitted change welcome form */ else if(isset($_POST['subwelcome'])){ $this->procwelcome(); } /* Should not get here, redirect to home page */ else{ header("Location: ../index.tcos"); } } /** * procDeleteUser - If the submitted username is correct, * the user is deleted from the database. */ function procDeleteUser(){ global $session, $database, $form; /* Username error checking */ $subuser = $this->checkUsername("deluser"); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } /* Delete user from database */ else{ $q = "DELETE FROM ".TBL_USERS." WHERE username = '$subuser'"; $database->query($q); header("Location: ".$session->referrer); } } /** * procaddnews */ function procaddnews(){ global $session, $database, $form; /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ $q = "INSERT INTO ".TBL_NEWS." (id, postdate, title, newstext) VALUES ('null', UNIX_TIMESTAMP() , '$_POST[title]', '$_POST[newstext]')"; $database->query($q); header("Location: ".$session->referrer); } } /** * procaddsong */ function procaddsong(){ global $session, $database, $form; /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ $q = "INSERT INTO ".TBL_SONGS." (id, postdate, title, length, link, lyrics) VALUES ('null', UNIX_TIMESTAMP() , '$_POST[title]', '$_POST[length]', '$_POST[link]', '$_POST[lyrics]')"; $database->query($q); header("Location: ".$session->referrer); } } /** * proceditsong */ function proceditsong(){ $this->time = time(); global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{if(ctype_digit($_GET['id'])) $article_id = $_GET['id']; else $article_id = 0;$query = "SELECT * FROM `songs` WHERE `id` = '" . $article_id . "' ;"; $result = mysql_query($query); if(mysql_num_rows($result) == 0) { echo "<h5 class=\"style2\">There are no songs with this article id</h5>"; } else{ while ($row = mysql_fetch_assoc ($result)) { $sql = "UPDATE songs SET title = '$_POST[title]' WHERE id = '" . $article_id . "' "; mysql_query($sql) or die("Error in $sql\n" . mysql_error()); $sql1 = "UPDATE songs SET length = '$_POST[length]' WHERE id = '" . $article_id . "' "; mysql_query($sql1) or die("Error in $sql1\n" . mysql_error()); header("Location: ".$session->referrer); } } } } /** * procwelcome */ function procwelcome(){ $this->time = time(); global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ mysql_query("UPDATE welcome SET welcome = '$_POST[welcome]' WHERE title = 'welcome'"); mysql_query("UPDATE welcome SET timestamp = UNIX_TIMESTAMP() WHERE title = 'welcome'"); header("Location: ".$session->referrer); } } /** * procDeletenews - If the submitted username is correct, * the user is deleted from the database. */ function procDeletenews(){ global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ mysql_query("DELETE FROM news WHERE title = '$_POST[delnews]'"); header("Location: ".$session->referrer); } } /** * checkUsername - Helper function for the above processing, * it makes sure the submitted username is valid, if not, * it adds the appropritate error to the form. */ function checkUsername($uname, $ban=false){ global $database, $form; /* Username error checking */ $subuser = $_POST[$uname]; $field = $uname; //Use field name for username if(!$subuser || strlen($subuser = trim($subuser)) == 0){ $form->setError($field, "* Username not entered<br>"); } else{ /* Make sure username is in database */ $subuser = stripslashes($subuser); if(strlen($subuser) < 5 || strlen($subuser) > 30 || !eregi("^([0-9a-z])+$", $subuser) || (!$ban && !$database->usernameTaken($subuser))){ $form->setError($field, "* Username does not exist<br>"); } } return $subuser; } }; /* Initialize process */ $adminprocess = new AdminProcess; ?>
  20. ahh ok then i will sort it out then and find it ive always writen code messy but i guess this is a lesson learnt lol ill get this fixed and hope it fixes
  21. i have looked through the rest of the code and i cannot find anything. would i be able to put all the files in a zip and email you them?
  22. ok i changed the sql to what you sugested $sql = "UPDATE songs SET title = '$_POST[title]' WHERE id = '" . $article_id . "' "; mysql_query($sql) or die("Error in $sql\n" . mysql_error()); $sql1 = "UPDATE songs SET length = '$_POST[length]' WHERE id = '" . $article_id . "' "; mysql_query($sql1) or die("Error in $sql1\n" . mysql_error()); and i got this error Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/evildoom/public_html/tcos/admin/adminprocess.tcos on line 203 <? /** * AdminProcess.php * * The AdminProcess class is meant to simplify the task of processing * admin submitted forms from the admin center, these deal with * member system adjustments. * * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) * Last Updated: August 15, 2004 */ include("include/session.tcos"); class AdminProcess { /* Class constructor */ function AdminProcess(){ global $session; /* Make sure administrator is accessing page */ if(!$session->isAdmin()){ header("Location: ../main.php"); return; } /* Admin submitted delete user form */ else if(isset($_POST['subdeluser'])){ $this->procDeleteUser(); } /* Admin submitted add news form */ else if(isset($_POST['subaddnews'])){ $this->procaddnews(); } /* Admin submitted delete news form */ else if(isset($_POST['subdelnews'])){ $this->procDeletenews(); } /* Admin submitted add song form */ else if(isset($_POST['subaddsong'])){ $this->procaddsong(); } /* Admin submitted edit song form */ else if(isset($_POST['subeditsong'])){ $this->proceditsong(); } /* Admin submitted change welcome form */ else if(isset($_POST['subwelcome'])){ $this->procwelcome(); } /* Should not get here, redirect to home page */ else{ header("Location: ../main.php"); } } /** * procDeleteUser - If the submitted username is correct, * the user is deleted from the database. */ function procDeleteUser(){ global $session, $database, $form; /* Username error checking */ $subuser = $this->checkUsername("deluser"); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } /* Delete user from database */ else{ $q = "DELETE FROM ".TBL_USERS." WHERE username = '$subuser'"; $database->query($q); header("Location: ".$session->referrer); } } /** * procaddnews */ function procaddnews(){ global $session, $database, $form; /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ $q = "INSERT INTO ".TBL_NEWS." (id, postdate, title, newstext) VALUES ('null', UNIX_TIMESTAMP() , '$_POST[title]', '$_POST[newstext]')"; $database->query($q); header("Location: ".$session->referrer); } } /** * procaddsong */ function procaddsong(){ global $session, $database, $form; /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ $q = "INSERT INTO ".TBL_SONGS." (id, postdate, title, length, link, lyrics) VALUES ('null', UNIX_TIMESTAMP() , '$_POST[title]', '$_POST[length]', '$_POST[link]', '$_POST[lyrics]')"; $database->query($q); header("Location: ".$session->referrer); } } /** * proceditsong */ function proceditsong(){ $this->time = time(); global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{if(ctype_digit($_GET['id'])) $article_id = $_GET['id']; else $article_id = 0;$query = "SELECT * FROM `songs` WHERE `id` = '" . $article_id . "' LIMIT 1;"; $result = mysql_query($query); if(mysql_num_rows($result) == 0) { echo "<h5 class=\"style2\">There is no news with this article id</h5>"; } else{ while ($row = mysql_fetch_assoc ($result)) { $sql = "UPDATE songs SET title = '$_POST[title]' WHERE id = '" . $article_id . "' "; mysql_query($sql) or die("Error in $sql\n" . mysql_error()); $sql1 = "UPDATE songs SET length = '$_POST[length]' WHERE id = '" . $article_id . "' "; mysql_query($sql1) or die("Error in $sql1\n" . mysql_error()); header("Location: ".$session->referrer); } } } /** * procwelcome */ function procwelcome(){ $this->time = time(); global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ mysql_query("UPDATE welcome SET welcome = '$_POST[welcome]' WHERE title = 'welcome'"); mysql_query("UPDATE welcome SET timestamp = UNIX_TIMESTAMP() WHERE title = 'welcome'"); header("Location: ".$session->referrer); } } /** * procDeletenews - If the submitted username is correct, * the user is deleted from the database. */ function procDeletenews(){ global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ mysql_query("DELETE FROM news WHERE title = '$_POST[delnews]'"); header("Location: ".$session->referrer); } } /** * checkUsername - Helper function for the above processing, * it makes sure the submitted username is valid, if not, * it adds the appropritate error to the form. */ function checkUsername($uname, $ban=false){ global $database, $form; /* Username error checking */ $subuser = $_POST[$uname]; $field = $uname; //Use field name for username if(!$subuser || strlen($subuser = trim($subuser)) == 0){ $form->setError($field, "* Username not entered<br>"); } else{ /* Make sure username is in database */ $subuser = stripslashes($subuser); if(strlen($subuser) < 5 || strlen($subuser) > 30 || !eregi("^([0-9a-z])+$", $subuser) || (!$ban && !$database->usernameTaken($subuser))){ $form->setError($field, "* Username does not exist<br>"); } } return $subuser; } }; /* Initialize process */ $adminprocess = new AdminProcess; ?>
  23. try this CREATE TABLE `images` ( `id` int(10) unsigned NOT NULL auto_increment, `mime` varchar(50) NOT NULL, `image` mediumblob NOT NULL, PRIMARY KEY (`id`) );
  24. song_edit.tcos <? /** * Admin.tcos */ include("include/session.tcos"); /** * User not an administrator, redirect to main page * automatically. */ if(!$session->isAdmin()){ header("Location: index.tcos"); } else{ /** * Administrator is viewing page, so display all * forms. */ ?> <html> <body> <h1>Song Actions please do not use yet!!</h1> <font size="5" color="#ff0000"> <b>::::::::::::::::::::::::::::::::::::::::::::</b></font> <font size="4">Logged in as <b><? echo $session->username; ?></b></font><br><br> Back to [<a href="index.tcos">Main Page</a>]<br><br> <? if($form->num_errors > 0){ echo "<font size=\"4\" color=\"#ff0000\">" ."!*** Error with request, please fix</font><br><br>"; } ?> <table align="left" border="0" cellspacing="5" cellpadding="5"> <?php if(ctype_digit($_GET['id'])) $song_id = $_GET['id']; else $article_id = 0; $query = "SELECT * FROM `songs` WHERE `id` = '" . $song_id . "' LIMIT 1;"; $result = mysql_query($query); if(mysql_num_rows($result) == 0) { echo "<h5 class=\"style2\">There are no songs with this id</h5>"; } else{ while ($row = mysql_fetch_assoc ($result)) { ?> <h3>Edit Song</h3> <? echo $form->error("editsong"); ?> <form action="adminprocess.tcos" method="POST"> Title:<br> <input type="text" name="title" maxlength="50" value="<?php echo "$row[title]";?>"><br> Length:<br> <input type="text" name="length" maxlength="50" value="<?php echo "$row[length]";?>"><br> Song Link (http://songlocation):<br> <input type="text" name="link" value="<?php echo "$row[link]";?>"><br> Lyrics:<br> <textarea rows="20" cols="90" name="lyrics"><?php echo "$row[lyrics]";?></textarea><br> <input type="hidden" name="subeditsong" value="1"> <input type="submit" value="Edit Song!"> </form> <?php } } ?> </table> </body> </html> <? } ?> adminprocess.tcos <? /** * AdminProcess.php * * The AdminProcess class is meant to simplify the task of processing * admin submitted forms from the admin center, these deal with * member system adjustments. * * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) * Last Updated: August 15, 2004 */ include("include/session.tcos"); class AdminProcess { /* Class constructor */ function AdminProcess(){ global $session; /* Make sure administrator is accessing page */ if(!$session->isAdmin()){ header("Location: ../main.php"); return; } /* Admin submitted delete user form */ else if(isset($_POST['subdeluser'])){ $this->procDeleteUser(); } /* Admin submitted add news form */ else if(isset($_POST['subaddnews'])){ $this->procaddnews(); } /* Admin submitted delete news form */ else if(isset($_POST['subdelnews'])){ $this->procDeletenews(); } /* Admin submitted add song form */ else if(isset($_POST['subaddsong'])){ $this->procaddsong(); } /* Admin submitted edit song form */ else if(isset($_POST['subeditsong'])){ $this->proceditsong(); } /* Admin submitted change welcome form */ else if(isset($_POST['subwelcome'])){ $this->procwelcome(); } /* Should not get here, redirect to home page */ else{ header("Location: ../main.php"); } } /** * procDeleteUser - If the submitted username is correct, * the user is deleted from the database. */ function procDeleteUser(){ global $session, $database, $form; /* Username error checking */ $subuser = $this->checkUsername("deluser"); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } /* Delete user from database */ else{ $q = "DELETE FROM ".TBL_USERS." WHERE username = '$subuser'"; $database->query($q); header("Location: ".$session->referrer); } } /** * procaddnews */ function procaddnews(){ global $session, $database, $form; /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ $q = "INSERT INTO ".TBL_NEWS." (id, postdate, title, newstext) VALUES ('null', UNIX_TIMESTAMP() , '$_POST[title]', '$_POST[newstext]')"; $database->query($q); header("Location: ".$session->referrer); } } /** * procaddsong */ function procaddsong(){ global $session, $database, $form; /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ $q = "INSERT INTO ".TBL_SONGS." (id, postdate, title, length, link, lyrics) VALUES ('null', UNIX_TIMESTAMP() , '$_POST[title]', '$_POST[length]', '$_POST[link]', '$_POST[lyrics]')"; $database->query($q); header("Location: ".$session->referrer); } } /** * proceditsong */ function proceditsong(){ $this->time = time(); global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{if(ctype_digit($_GET['id'])) $article_id = $_GET['id']; else $article_id = 0;$query = "SELECT * FROM `songs` WHERE `id` = '" . $article_id . "' LIMIT 1;"; $result = mysql_query($query); if(mysql_num_rows($result) == 0) { echo "<h5 class=\"style2\">There is no news with this article id</h5>"; } else{ while ($row = mysql_fetch_assoc ($result)) { mysql_query("UPDATE songs SET title = '$_POST[title]' WHERE id = '" . $article_id . "' "); mysql_query("UPDATE songs SET length = '$_POST[length]' WHERE id = '" . $article_id . "' "); header("Location: ".$session->referrer); } } } /** * procwelcome */ function procwelcome(){ $this->time = time(); global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ mysql_query("UPDATE welcome SET welcome = '$_POST[welcome]' WHERE title = 'welcome'"); mysql_query("UPDATE welcome SET timestamp = UNIX_TIMESTAMP() WHERE title = 'welcome'"); header("Location: ".$session->referrer); } } /** * procDeletenews - If the submitted username is correct, * the user is deleted from the database. */ function procDeletenews(){ global $session, $database, $form; if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } else{ mysql_query("DELETE FROM news WHERE title = '$_POST[delnews]'"); header("Location: ".$session->referrer); } } /** * checkUsername - Helper function for the above processing, * it makes sure the submitted username is valid, if not, * it adds the appropritate error to the form. */ function checkUsername($uname, $ban=false){ global $database, $form; /* Username error checking */ $subuser = $_POST[$uname]; $field = $uname; //Use field name for username if(!$subuser || strlen($subuser = trim($subuser)) == 0){ $form->setError($field, "* Username not entered<br>"); } else{ /* Make sure username is in database */ $subuser = stripslashes($subuser); if(strlen($subuser) < 5 || strlen($subuser) > 30 || !eregi("^([0-9a-z])+$", $subuser) || (!$ban && !$database->usernameTaken($subuser))){ $form->setError($field, "* Username does not exist<br>"); } } return $subuser; } }; /* Initialize process */ $adminprocess = new AdminProcess; ?> is that ok for you? i did notice that teh code was rather messy
×
×
  • 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.