Jump to content

seanstuart

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

seanstuart's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. justr installed phpauction, but get this error message on index page.......... any pointers? Sean
  2. sorry...! when a link is submitted i class it as a item
  3. these are my other tables.. NO item table! DROP TABLE IF EXISTS `adsense`; CREATE TABLE `adsense` ( `adsenseid` int(4) NOT NULL auto_increment, `adsensecode` longtext NOT NULL, UNIQUE KEY `adsenseid` (`adsenseid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; ------------------------------------ CREATE TABLE `confset` ( `indc` int(4) NOT NULL auto_increment, `path` varchar(255) NOT NULL default '/', `paypal` varchar(255) NOT NULL default 'yourname@paypal.com', `paypalcurrency` varchar(255) NOT NULL default 'USD', `contactmail` varchar(255) NOT NULL default 'yourname@yourdomain.com', `adminmail` varchar(255) NOT NULL default 'yourname@yourdomain.com', `currency` varchar(255) NOT NULL default '1', `minbid` varchar(9) NOT NULL default '1.00', `minup` varchar(9) NOT NULL default '1.00', `currencymail` varchar(255) NOT NULL default '1', `pathmail` varchar(255) NOT NULL default '/', `frommail` varchar(255) NOT NULL default 'yourname@yourdomain.com', `contactmailsubject` varchar(255) NOT NULL default 'message from yoursite.com', `domainname` varchar(255) NOT NULL default 'www.yourdomain.com', `sitetitle` varchar(255) NOT NULL default 'Your Site Title Slogan', `custom` varchar(255) NOT NULL default '', `lbdtemplate` varchar(255) NOT NULL default 'default', `alphacat` char(1) NOT NULL default 'C', `prenabled` char(1) NOT NULL default 'Y', `screenshot` char(1) NOT NULL default 'Y', `buymailsubject` varchar(255) NOT NULL default 'Your submission at LinkBidScript.com', `buymailmessage` longtext NOT NULL, `bidmailsubject` varchar(255) NOT NULL default 'Thank you for your bid!', `bidmailmessage` longtext NOT NULL, `pr_google` char(1) NOT NULL default 'Y', `pr_yahoo` char(1) NOT NULL default 'Y', `pr_msn` char(1) NOT NULL default 'Y', `pr_alexa` char(1) NOT NULL default 'Y', `prp_latest` char(1) NOT NULL default 'Y', `prp_category` char(1) NOT NULL default 'Y', `prp_details` char(1) NOT NULL default 'Y', `prp_home` char(1) NOT NULL default 'Y', `prp_links` char(1) NOT NULL default 'Y', `prp_list` char(1) NOT NULL default 'Y', `prp_search` char(1) NOT NULL default 'Y', `cntIM` char(1) NOT NULL default 'N', UNIQUE KEY `indc` (`indc`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; ---------------------------------------------- CREATE TABLE `currency` ( `curid` int(4) NOT NULL auto_increment, `curenc` varchar(255) NOT NULL default '', `cursign` varchar(255) NOT NULL default '', UNIQUE KEY `curid` (`curid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; --------------------------------------------- CREATE TABLE `do_ban` ( `do_do` int(4) NOT NULL auto_increment, `do_ban` varchar(255) NOT NULL default '', `do_enable` varchar(255) NOT NULL default 'Y', UNIQUE KEY `do_do` (`do_do`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; ------------------------------------------ CREATE TABLE `google_cse` ( `cse_id` int(4) NOT NULL auto_increment, `cse_main` longtext, `cse_on` char(1) NOT NULL default 'Y', UNIQUE KEY `cse_id` (`cse_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; ---------------------------------------------- CREATE TABLE `ig_admin` ( `adid` int(4) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `pass` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', UNIQUE KEY `adid` (`adid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=0 AUTO_INCREMENT=13 ; --------------------------------------------- CREATE TABLE `ip_ban` ( `ip_id` int(4) NOT NULL auto_increment, `ip_ip` varchar(255) NOT NULL default '', `ip_enable` varchar(255) NOT NULL default 'Y', UNIQUE KEY `ip_id` (`ip_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; ----------------------------------------------- CREATE TABLE `linknumber` ( `lnbid` int(4) NOT NULL auto_increment, `lnbhome` varchar(255) NOT NULL default '5', `lnbcategory` varchar(255) NOT NULL default '2', `lnbalphabet` varchar(255) NOT NULL default '2', `lnbtoplinks` varchar(255) NOT NULL default '30', `lnbnewlinks` varchar(255) NOT NULL default '30', UNIQUE KEY `lnbid` (`lnbid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -------------------------------------------- CREATE TABLE `main` ( `dtu` int(4) NOT NULL auto_increment, `categ` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', `site` varchar(255) NOT NULL default '', `title` varchar(255) NOT NULL default '', `descr1` varchar(255) NOT NULL default '', `descr2` longtext NOT NULL, `mdesc` varchar(255) NOT NULL default '', `mword` varchar(255) NOT NULL default '', `deeptf` varchar(255) NOT NULL default 'Deep Link 1', `deepts` varchar(255) NOT NULL default 'Deep Link 2', `deeptt` varchar(255) NOT NULL default 'Deep Link 3', `dfurl` varchar(255) NOT NULL default 'http://', `dsurl` varchar(255) NOT NULL default 'http://', `dturl` varchar(255) NOT NULL default 'http://', `bid` int(4) NOT NULL default '0', `stad` date NOT NULL default '0000-00-00', `stod` date NOT NULL default '0000-00-00', `stup` date NOT NULL default '0000-00-00', `avail` varchar(255) NOT NULL default '', `paid` varchar(255) NOT NULL default '', `ujbid` varchar(255) NOT NULL default '', `maincategory` varchar(255) NOT NULL default '17', `google` varchar(255) NOT NULL default '', `yahoo` varchar(255) NOT NULL default '', `msn` varchar(255) NOT NULL default '', `alexa` varchar(255) NOT NULL default '', `pr_date` date default NULL, UNIQUE KEY `dtu` (`dtu`), KEY `bid` (`bid`), KEY `bid_2` (`bid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=154 ; --------------------------------------------
  4. table structure..... CREATE TABLE `categorylisting` ( `catlistid` int(4) NOT NULL auto_increment, `categoryname` varchar(255) NOT NULL default '', `categtitle` varchar(255) NOT NULL default '', `categdescription` varchar(255) NOT NULL default '', `categkeyword` varchar(255) NOT NULL default '', `categenable` char(1) NOT NULL default 'Y', `categseoname` varchar(255) NOT NULL default '', `parentid` int(11) NOT NULL default '0', `categauxC` varchar(255) NOT NULL default '', UNIQUE KEY `catlistid` (`catlistid`) ) TYPE=MyISAM AUTO_INCREMENT=38 ;
  5. my existing code looks like this........ <?php do { ?> <li><a href="<?php echo("$path");?><?php echo $row_categRL['categseoname']; ?>/"><?php echo $row_categRL['categoryname']; ?></a></li> <?php $row_categRL = mysql_fetch_assoc($categRL); if (!isset($nested_categRL)) { $nested_categRL= 1; } } while ($row_categRL); ?>
  6. i have would like to know how to code a query..... I have a categories section and when a item is added to a category it shows a number next to it to show how many items are in that category.... blogs (1) and so on. thanks Sean!
  7. this is how the origonal script looks at add_menu_item.php... and edit_menu_item.php will i have to these and how would i call it? <?php require_once("access.php"); require_once(LIB_PATH."Restaurant.php"); require_once(LIB_PATH."Menu.php"); require_once(LIB_PATH."MenuSection.php"); require_once(LIB_PATH."MenuItem.php"); $restaurant_id = Sanitize::data($_GET['restaurant_id'], "integer"); $menu_id = Sanitize::data($_GET['menu_id'], "integer"); $section_id = Sanitize::data($_GET['section_id'], "integer"); if($restaurant_id == 0){ $error_message = "You must select a restaurant, prior to be able to add a menu item!"; }elseif($menu_id == 0){ $error_message = "You must select a menu, prior to be able to add a menu item!"; }else{ $restaurant_obj = new Restaurant($restaurant_id); if($restaurant_obj->user_id == $_SESSION['logged_user_id']){ $menu_obj = new Menu($restaurant_id); //get the menu sections $menu_sections = MenuSection::allMenuSections($menu_obj->menu_id); if(multiArraySearchValue($menu_sections, 'section_id', $section_id) >= 0){ /** * Determinate does the form was submited. */ if($_SERVER['REQUEST_METHOD'] == "POST"){ /** * Intance the restaurant object */ $mi_obj = new MenuItem(); /** * Sanitize the posted values. */ $item_name = Sanitize::data($_POST['item_name'], "string"); $item_description = Sanitize::data($_POST['item_description'], "string"); $item_price = Sanitize::data($_POST['item_price'], "float"); $item_order = Sanitize::data($_POST['item_order'], "string"); $section_id = Sanitize::data($_POST['section_id'], "integer"); /** * Set the object properties. */ $mi_obj->setMember("item_name", $item_name); $mi_obj->setMember("item_description", $item_description); $mi_obj->setMember("item_price", $item_price); $mi_obj->setMember("item_order", $item_order); $mi_obj->setMember("section_id", $section_id); /** * Try to add the new menu section to the database. */ if($mi_obj->add($error_message)){ /** * Redirect the user to the "thank you" page. */ header("location: restaurant.php?id=$restaurant_id"); exit; } } }else{ //this menu section do not belongs to the current logged user $error_message = "You must create at least one menu section, prior to be able to add a menu item!"; } }else{ //this menu restaurant do not belongs to the current logged user header("location: index.php"); exit; } if(! $item_status) $item_status = 1; /** * Get the menu sections array. */ $menu_sections = MenuSection::allMenuSections($menu_id); $select_section = get_select_box_db('0', $section_id, "section_id", $menu_sections, 'section_name', 'section_id', '---select---', 'base', ''); } $form_title = "Add a new menu item"; $website_title = "Add menu item - ".$_SESSION['settings']['site_title']; $website_description = $_SESSION['settings']['site_description']; $site_keywords = $_SESSION['settings']['site_keywords']; require_once(WEB_TEMPLATES."HeaderTemplate.php"); require_once(WEB_TEMPLATES."MenuItemManageTemplate.php"); require_once(WEB_TEMPLATES."FooterTemplate.php"); ?>
  8. I am working with a CMS Restaurant system, I would like to allow owners to have an option to select currency type e.g [ $,£ and €, ] what would be the easyest way to achieve this without having to edit lots of files? regards Sean
  9. if (isset($_POST['sb1'])){ form now displays, but still just clears input fields.... ???
  10. is this correct, as i get a blank screen..... if (isset($_POST['sb1'] == "submit")){ sean
  11. I try to login to admin, but when I submit form it just clears its self???? form code.... <?php include_once("../lib/config.php"); include_once(LIB_PATH."Admin.php"); /** * Set the variable, which holds the error message, to an empty variable. */ $error = ""; if($_SERVER['REQUEST_METHOD'] == "POST"){ /** * Sanitize the posted data - remove any html code, if submited, remove "whote" spaces, cast to "string" data type. */ $admin_username = Sanitize::data($_POST['admin_username'], 'string'); $admin_password = Sanitize::data($_POST['admin_password'], 'string'); if(empty($admin_username)){ $error = "Type your username, please!"; }elseif(empty($admin_password)){ $error = "Type your password, please!"; }else{ $admin_obj = new Admin(); if($admin_obj->login($admin_username, $admin_password, &$error)){ //the user is logged successfully, redirect him to the protected area header("location: index.php"); exit; } } } ?> <html> <head> <title>Admin area</title> <link href="../public/style/admin_styles.css" type="text/css" rel="stylesheet" /> </head> <body> <form method="post" action="login.php"> <table align="center" style="margin-top: 10%" class="base"> <tr> <td colspan="2" align="center" class="title">Admin Login Form</td> </tr> <tr> <td colspan="2" align="center" class="error"><?php echo $error; ?></td> </tr> <tr> <td>Username:</td> <td><input type="text" name="admin_username" size="25" value="<?php echo $admin_username; ?>" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="admin_password" size="25" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="sb1" value="Submit" /></td> </tr> <tr> <td colspan="2" style="padding-top: 30px"> <a href="forgot_password.php" class="base_link">Forgot password?</a> </td> </tr> </table> </form> </body> </html> admin.php......... <?php include("config.php"); /** * This class is created to handle the admin user functionalities, such as login, forgot password, edit profile. * * @package Takeout&Delivery Module * @author Venelin Manchev * @link http://www.php-developers.net * @version 0.1 */ class Admin { /** * Admin Id number */ var $admin_id; /** * Admin username */ var $admin_username; /** * Admin password */ var $admin_password; /** * Admin email address */ var $admin_email; function Admin($id= 0){ /** * Get the database connection. */ global $db; if($id > 0){ /** * Build the SQL query to grab the admin user info and to set the object properties. */ $sql = "SELECT * from tdm_admin where admin_id = '$id' "; if(!$db->Query($sql)){ logMyErrors(__FILE__, __CLASS__, __METHOD__, __LINE__, $db->Error()); return false; }else{ $admin_array = $db->RecordsArray(MYSQL_ASSOC); if(is_array($admin_array)){ if(count($admin_array) == 1){ foreach($admin_array['0'] as $key=>$value){ $this->$key = $value; } }else{ return false; } } } } } /** * Admin login functionality * * @param string $username Admin username value, posted via the login form. * @param string $password Admin password value, posted via the login form. * @param string &$error_message Error message on failure, passed by reference. * @return boolean True on success, False on failure. If true, a session variable admin_id will hold the admin id number value. */ function login($username, $password, &$error_message) { /** * Get the database connection */ global $db; $sql = "SELECT admin_id, admin_password from tdm_admin where admin_username = '$username' "; if(!$db->Query($sql)){ logMyErrors(__FILE__, __CLASS__, __METHOD__, __LINE__, $db->Error()); return false; }else{ $db->MoveFirst(); $result_data = $db->Row(); if($result_data->admin_id > 0){ if($result_data->admin_password != md5($password)){ $error_message = "Wrong password!"; return false; }else{ $_SESSION['admin_id'] = $result_data->admin_id; return true; } }else{ $error_message = "Wrong username!"; return false; } } } /** * Admin logout functionality * * @return boolean True on successful logout, false otherwise. */ function logout() { session_unset("admin_id"); session_unregister("admin_id"); session_destroy(); } /** * Update an admin account * * @param int $admin_id Admin account id number to update. * @param string &$error Error message text, passed by reference. * @return boolean True on success, false otherwise. */ function updateAdmin($admin_id, &$error){ /** * Get the database connection */ global $db; /** * Validate the posted data. */ if(empty($this->admin_username)){ $error = "Type the username, please!"; return false; }elseif(empty($this->p1)){ $error = "Type the password, please!"; return false; }elseif(empty($this->p2)){ $error = "Confirm the password, please!"; return false; }elseif($this->p1 != $this->p2){ $error = "Retype and confirm the password, please!"; return false; }elseif(!checkEmailAddress($this->admin_email)){ $error = "Type a correct email address, please!"; return false; }else{ /** * Build the SQL query string. */ $sql = "UPDATE tdm_admin set admin_username = '$this->admin_username', admin_password = MD5('$this->p1'), admin_email = '$this->admin_email' "; if(!$db->Query($sql)){ $error = $db->Error(); return false; }else{ return true; } } } /** * Set a new value for object property. */ function setMember($name, $value) { $this->$name = $value; } /** * This method handle the forgot password process. * * The admin user must submit his username. In case of match, the system will generate a new password, will assign it as MD5-encripted hash to the admin account and will send an email to the admin email address with the new password. * *@param string $username Admin username value, submited via the forgot password form. *@param string &$error_message Error message text, passed by reference. *@return boolean True on success, false otherwise. */ function forgotPassword($username, &$error_message) { /** * Get the database connection. */ global $db; $sql = "select * from tdm_admin where admin_username = '$username' "; if(!$db->Query($sql)){ logMyErrors(__FILE__, __CLASS__, __METHOD__, __LINE__, $db->Error()); }else{ $db->MoveFirst(); $result_data = $db->Row(); if($result_data->admin_id > 0){ //generate the new password $new_password = self::generatePassword(); //save the new password $sql = "update tdm_admin set admin_password = MD5('$new_password') where admin_id = '$result_data->admin_id' "; if(!$db->Query($sql)){ logMyErrors(__FILE__, __CLASS__, __METHOD__, __LINE__, $db->Error()); }else{ //get the TXT template $txt_template = file_get_contents(EMAIL_TEMPLATES."admin_forgot.txt"); //setup the template variables $tpl_variables = array("{website}", "{username}", "{password}", "{login_url}"); //setup the template values $tpl_values = array(WEBSITE_DOMAIN, $username, $new_password, ADMIN_LOGIN_URL); //parse the template $txt_message = str_replace($tpl_variables, $tpl_values, $txt_template); //send the new password sendMime($_SESSION['settings']['contact_email'], $_SESSION['settings']['contact_email'], $result_data->admin_email, '', '', 3, 'New password', $txt_message, $html_message); return true; } }else{ $error_message = "Wrong username!"; return false; } } } /** * This method generate a new password. * * In case of forgotten password, we need a new one, geenrated on a random manier. * @access private * @return string New password string. */ function generatePassword() { //generate a random md5 hash $md5_hash = md5(crypt(time())); //the password should be no more than 6 chars in length $new_password = substr($md5_hash, 0, 6); return $new_password; } } ?> >
  12. my version of mysql did not like .................... ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ; now sorted thanks..... Sean
  13. I get a #1064 sytax error::::: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'collate latin1_general_ci NOT NULL default '', `admin_passwo -- -- Table structure for table `tdm_admin` -- CREATE TABLE `tdm_admin` ( `admin_id` int(10) NOT NULL auto_increment, `admin_username` varchar(100) collate latin1_general_ci NOT NULL default '', `admin_password` varchar(32) collate latin1_general_ci NOT NULL default '', `admin_email` varchar(255) collate latin1_general_ci NOT NULL default '', PRIMARY KEY (`admin_id`), KEY `admin_username` (`admin_username`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ; -- -- Dumping data for table `tdm_admin` -- INSERT INTO `tdm_admin` VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'support@php-developers.net'); -- -------------------------------------------------------- [code] regards Sean [/code]
×
×
  • 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.