function login_alias_on_login($tools) { $username = $_POST['user']; $alias = get_alias($username, $tools); if ($alias) { $_POST['user'] = $alias; } }
break; case '.txt': $contentType = 'text/plain'; break; } } if ($_POST['mode'] == '27') { $actionToTake = 'edit'; } else { $actionToTake = 'new'; } if ($actionToTake === 'edit' && empty($id)) { $e->setError(2); $e->dumpError(); } $alias = get_alias($id, $alias, $parent, $pagetitle); if (empty($pub_date)) { $pub_date = 0; } else { $pub_date = $modx->toTimeStamp($pub_date); if (empty($pub_date)) { $modx->manager->saveFormValues(27); $url = "index.php?a=27&id={$id}"; include_once "header.inc.php"; $modx->webAlert($_lang["mgrlog_dateinvalid"], $url); include_once "footer.inc.php"; exit; } elseif ($pub_date < $currentdate) { $published = 1; } elseif ($pub_date > $currentdate) { $published = 0;
function createad($title, $section, $category, $age, $sp, $info, $mimg, $img1, $img2, $group, $contact, $email, $warranty, $pn, $date, $timg) { $created = date("Y-m-d") . ' 00:00:00'; $day = date("d") - 1; $publish_up = date("Y-m") . '-' . $day . ' 00:00:00'; $uniqueid = get_rand_id(16); $q = "INSERT INTO `ads` (`id`, `title`, `section`, `category`, `age`, `sp`, `info`, `mimg`, `img1`, `img2`, `group`, `contact`, `email`, `warranty`, `pn`, `date`, `uniqueid`, `timg`) VALUES (NULL, '{$title}', '{$section}', '{$category}', '{$age}', '{$sp}', '{$info}', '{$mimg}', '{$img1}', '{$img2}', '{$group}', '{$contact}', '{$email}', '{$warranty}', '{$pn}', '{$date}', '{$uniqueid}', '{$timg}')"; mysql_query($q) or die('MySQL Error( Submit Ad )!!'); $q = "SELECT id FROM `ads` WHERE `uniqueid`='" . $uniqueid . "'"; $result = mysql_query($q) or die('MySQL Error(3)!!'); $row = mysql_fetch_array($result); $aid = $row['id']; $alias = get_alias($title); $mdesc = $info; $mkey = preg_replace('/^(A-Za-z0-9)*/', ',', $title); if (!$uid) { $uid = 62; } //$dt=strtotime($created)+($valid*24*3600); //$valid=date("Y-m-d H:i:s", $dt); $q = "INSERT INTO `jos_content` (\n`id` ,\n`title` ,\n`alias` ,\n`title_alias` ,\n`introtext` ,\n`fulltext` ,\n`state` ,\n`sectionid` ,\n`mask` ,\n`catid` ,\n`created` ,\n`created_by` ,\n`created_by_alias` ,\n`modified` ,\n`modified_by` ,\n`checked_out` ,\n`checked_out_time` ,\n`publish_up` ,\n`publish_down` ,\n`images` ,\n`urls` ,\n`attribs` ,\n`version` ,\n`parentid` ,\n`ordering` ,\n`metakey` ,\n`metadesc` ,\n`access` ,\n`hits` ,\n`metadata`,\n`aid`\n)\nVALUES (\nNULL , '" . $title . "', '" . $alias . "', '', '<p>{module View Ads}</p>', '', '1', '" . $section . "', '0', '" . $category . "', '" . $created . "', '" . $uid . "', '', '" . $created . "', '0', '0', '0000-00-00 00:00:00', '" . $publish_up . "', '0000-00-00 00:00:00', '', '', 'show_title=0\nlink_titles=0\nshow_intro=1\nshow_section=0\nlink_section=\nshow_category=0\nlink_category=\nshow_vote=0\nshow_author=0\nshow_create_date=0\nshow_modify_date=0\nshow_pdf_icon=0\nshow_print_icon=0\nshow_email_icon=0\nlanguage=en-GB\nkeyref=\nreadmore=', '1', '0', '1', '" . $mkey . "', '" . $mdesc . "', '0', '0', 'robots=\nauthor=', '" . $aid . "'\n)"; $result = mysql_query($q) or die('MySQL Error(2)!!'); $q = "SELECT id FROM `jos_content` WHERE `aid`=" . $aid; $resultt = mysql_query($q) or die('MySQL Error(112)!!'); $roww = mysql_fetch_array($resultt); $q = "UPDATE `ads` SET `artid` = '" . $roww['id'] . "' WHERE `ads`.`id` ={$aid}"; $result = mysql_query($q) or die('sqlerr 121 createad'); $q = "INSERT INTO `ad_visibility` (`aid`, `gid`) VALUES ('{$aid}', '{$group}')"; $result = mysql_query($q) or die('sqlerr 122 creatad'); /*echo '<script type="text/javascript"> alert("Ad Submitted Successfully !!"); </script>';*/ message('Ad Submitted Successfully !! An e-mail with information regarding managing this Ad has been sent to you. If you can\'t find the email in your inbox then check your spam folder.'); return $roww['id'] . ":" . $uniqueid; }
function get_alias($product_name, $trial = 0) { $conn = connDB(); $product_name = preg_replace('/[^a-zA-Z0-9\\s\\/\\-+_\\|]/', '', $product_name); $product_name = strtolower($product_name); $product_name = preg_replace('/[\\s\\/\\-+_\\|]/', '-', $product_name); if ($trial != 0) { $product_name = $product_name . '-' . $trial; } $check = mysql_query("SELECT * from tbl_product WHERE product_alias='{$product_name}'", $conn); if (mysql_num_rows($check) != null) { $trial++; get_alias($product_name, $trial); } else { return $product_name; } }
} .rev { font-size: 12px; } .cs { font-family: "Comic Sans MS", cursive; font-size: 14px; } --> </style> <?php $link = "../viewad.php/" . $row['alias'] . "/?id=" . $id; $q = "SELECT * FROM `groups` WHERE id=" . $ad['group']; $result = mysql_query($q) or die('sql error mod_group 1'); $row = mysql_fetch_array($result); $group_link = "index.php?n=" . get_alias($row['alias']) . "&&gid=" . $row['id']; ?> <?php if ($admin) { ?> <a href="delete_ad.php?token=<?php echo $ad['uniqueid']; ?> " target="_new">Delete Ad</a> <a href="editad.php?token=<?php echo $ad['uniqueid']; ?> " target="_blank">Edit Ad</a> <?php } ?> <table width="700" border="0">