Jump to content

alco19357

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by alco19357

  1. it does not send the mail period? or it just does not email the "password"?
  2. you're problem lays here i believe // you have # if($numrows != "0" & $password == $fetch_em["password"]) { //switch it to: (with two && if($numrows != "0" && $password == $fetch_em["password"]) { also, make sure you ALWAYS encrypt passwords with atleast md5 (i like sha256)
  3. not quite sure what you're asking... but try using a loop: while($row = mysql_fetch_array($queriedstring)){ // code here }
  4. Hey try this: then add the following in a php file <?php $file = $_GET['file']; // a get string with the filename (eg: test.pdf) $dir = "files/"; if(personisloggedin){ // check login if(is_file($dir.$file)){ // checks if files/test.pdf exists chmod($dir, 0777); // chmod for file opening and reading header("Content-type: application/force-download"); header('Content-Disposition: inline; filename="' . $dir.$file . '"'); // will post on screen header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($dir.$file)); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $file . '"'); readfile("$dir$file"); // echo file on screen chmod("files/", 0744); // close and chmod directory back up }else{ echo "File does not exist"; } }else{ echo "You must be logged in to view files."; } ?> good luck
  5. INSERT INTO table (field1, field2, field 3) VALUES ('value1', 'value2', 'value3'), ('value1', 'value2', 'value3'); // and so on
  6. my example's the same, it just shows you the output too
  7. no. it should work. try this: mysql_query("UPDATE announcements SET comment_field = '".$i."' WHERE id='0'"); //mysql_query("UPDATE announcements SET comment_field = 'This does update for me' WHERE id='0'"); you might need to use single quotes (i already inserted them)
  8. it's really hard without any code to check. are you doing an if.. else statement? so maybe if the the name isn't set, then it just stops parsing the rest? also, where are you storing the entered values in which you call to later to populate the form? more information/code would greatly help
  9. <?php if($_GET['d'] == '2'){ header("Content-Type: text/plain"); $_screens = $_POST['screens']; foreach($_screens as $key => $name) { echo "screens[".$key."] = ".$name . "\n"; } }else{ ?> <form action="?d=2" method="post"> <input type="text" value="first value" name="screens[]"> <input type="text" value="second value" name="screens[]"> <input type="submit" value="submit"> </form> <?php }?> try that. you don't need to declare a new array since name="screens[]" means array anyways. you can also use predefined keys with this by simply placing the key name inside the two brackets. example: name="screens[key1]" would export screens[key1] = somevalue when done in the above php example. the reason it wasn't working earlier was because you had two brackets after your defining of the post field: $screens[] = $_POST['screens']; it should have just been $screens = $_POST['screens']; then you could do a loop on $screens good luck, alex
  10. i'm probably an idiot cause now it works. i probably just did "$intokey" instead of "$intoKey". wow, 2 weeks wasted
  11. Does the internet browser you're using support ajax like you asked in the code? I know it's a silly question, but typically that is the problem.
  12. The class file function search($query=''){ preg_match_all("|\([^(]+\)|U", $query, $keys, PREG_PATTERN_ORDER); $retrieve_r = substr(trim($keys[0][0]), 1, (strlen(trim($keys[0][0]))-2)); $where_r = substr(trim($keys[0][1]), 1, (strlen(trim($keys[0][1]))-2)); $rePlacePattern = array("|\([^(]+\)|U", "/select/", "/from/", "/where/"); $fillPattern = array("", "", "", ""); $whatsLeft = trim(preg_replace($rePlacePattern, $fillPattern, $query)); preg_match_all("/(.*)(key=)(.*)(primary=)(.*)/i", $whatsLeft, $leftOver, PREG_SET_ORDER); $xmlfile = trim($leftOver[0][1]); $intoKey = trim($leftOver[0][3]); $primaryKey = trim($leftOver[0][5]); $whatsLeft2 = preg_replace($rePlacePattern, $fillPattern, $query); preg_match_all("/(.*)(key=)(.*)(primary=)(.*)/U", $whatsLeft2, $explode, PREG_SET_ORDER); $_SESSION['trysession'] = trim($explode[0][3]); $trysession = $_SESSION['trysession']; $_wherePre = (string)(urldecode($intokey)); $_whereClause_r = "[@user_id='1' or @sort_id='2']"; $_whereClause = substr(trim($_whereClause_r), 1, (strlen(trim($_whereClause_r))-2)); // removes the front and back brackets $stripFirst = trim(preg_replace('/(^and |^or )/i', '', trim($_whereClause))); $stripLast = trim(preg_replace('/( and$| or$)/i', '', $stripFirst)); preg_match_all('/( or | and )/i', $stripLast, $whereStatements, NULL); $getContents = preg_split('/( or | and )/i', $stripLast); //settype($_wherePre, 'string'); $_construct_where = array(); for($i=0; $i<count($getContents); $i++){ $identifier = trim($getContents[$i]); $value = trim($whereStatements[0][$i-1]); $totalInArray = count($_construct_where); if($value == 'and' && $i > 0){ $_construct_where[$totalInArray-1] = $_construct_where[$totalInArray-1].' '.$value.' '.$identifier; $i = $i; }elseif($value == 'or'){ $_construct_where[$totalInArray] = $identifier; }else{ $_construct_where[$totalInArray] = $identifier; } } $dom = new DOMDocument(); $dom->load($this->include_dir . '/' . $this->xml_dir . '/' . 'users' . '/' . 'users' . '.xml'); $xpath = new domxpath($dom); $return = array(); foreach($_construct_where as $whereClause){ var_dump($_wherePre); $childs = $xpath->query($_wherePre . "[" . $whereClause . "]"); foreach($childs as $child){ $return_attr = array(); //if((count($getAttr) == 1) && ($getAttr[0] == '*')){ if(1==1){ $selectall = $xpath->query($_wherePre . "[" . $whereClause . "]" . "/basic_info/@*"); foreach($selectall as $all){ $return_attr[] = $all->textContent; } }else{ foreach($getAttr as $attr){ $attribute = $xpath->query("/users/user[@user_id='1' and @sort_id='2']/basic_info/@*"); foreach($attribute as $a){ $return_attr[$attr] = $a->textContent; } } } //$getPrimaryKey = $xpath->query($primary_key); //foreach($getPrimaryKey as $primaryKey){ //$return[$primaryKey->textContent] = $return_attr; $return[] = $return_attr; //} } } // echo gettype($_wherePre); } the calling file $str = "select (as) from clothing/mens key=users/user primary=[@user_id] where (@item_id='322' or @item_id='343')"; print_r( $xml->search($str) ); the response
  13. ditto. wasn't thinking that while i was doing it. but yes
  14. Yes. But are they final? In order to have "good" tables, the programmer must go through and finalize all aspects of the integration, thus lessing the stress of changing up the table later on.
  15. <?php # alco19357 mysql_connect(HOST, USER, PASS); mysql_select_db(DB); $query_cats = mysql_query("select * from category"); $cats = array(); while($cat = mysql_fetch_array($query_cats)){ $query_subcats = mysql_query("select * from subcategory where subcategory_categoryid='".$cat["category_categoryid"]."'"); $subcats = array(); $articles = 0; while($subcat = mysql_fetch_array($query_subcats)){ $query_articles = mysql_query("select * from articles where articles_subcategoryid='".$subcat["subcategory_subcategoryid"]."'"); $subcats[$subcat["subcategory_subcategoryid"]] = array("id" => $subcat["subcategory_subcategoryid"], "title" => $subcat["subcategory_title"], "articles" => mysql_num_rows($query_articles)); $articles = mysql_num_rows($query_articles)+$articles; } $cats[$cat["category_categoryid"]] = array("id" => $cat["category_categoryid"], "title" => $cat["category_title"], "subcats" => $subcats, "articles" => $articles); } $echo = ''; $row = 0; foreach($cats as $_cat){ $row++; if($row > 1){ $echo .= '<br>'; } $echo .= $_cat["title"].' ('.$_cat["articles"].')'; foreach($_cat["subcats"] as $_sub){ $echo .= '<br> '.$_sub["title"].' ('.$_sub["articles"].')'; } } ?>
  16. i typically put my includes in a directory called "includes" then i just chmod it to 744 or something along those lines. if you want, you can also create other files (like .dll) and use those as your includes i guess. chmoding is a pretty safe way to go about (at least i feel). interesting question though
  17. since when can we send images via SMS? i thought SMS was exclusively for text in 160max characters?
  18. if each product has a unique product id, then do this (assume product id is equal to = 'pid' in db) $result = mysql_query("SELECT * FROM products")or die(mysql_error()); $save_buffer = array(); while($row = mysql_fetch_array($result)){ if(!in_array($row['pid'], $save_buffer)){ echo $row['category']; $save_buffer[] = $row['pid']; } } #this will be a simple hack to avoid multiple category listing... best practice is to separate your categories and products into separate tables
  19. $var ? $var : ' ' if $var is set, then echo $var, else echo ' ' you would need an echo in front of $var though
  20. Just make your default landing page like this: <?php $page = $_GET['page']; if($page == 'a'){ $view = 'a.php'; }elseif($page == 'b'){ $view = 'b.php'; }else{ $view = 'default.php'; } echo("This will always be at the top.<br/>"); //# This will dynamically include the file in the querystring "page". Example index.php?page=a or ?page=b and now it won't be hackable include($view); echo("This will always be at the bottom.<br/>"); ?>
  21. Hello, I am making a script that uses various preg_match_all and I want to derive users/user from: "more code here key=users/user more code here" Once I get the key name, I want to use it in xpath/dom with php to do a query, such that: $childs = $xpath->query($_wherePre . "[" . $whereClause . "]"); $_wherePre would be the derived key name, with some added trim functions, etc. and $whereClause represents attribute where clauses given in a loop (this part works fine) It's the $_wherePre I can't get to work. I've done debugging and when I enter: $_wherePre = "users/user"; into my php script, it works fine... but when I enter $_wherePre = trim($derivedKey); (which when I enter in debugging: echo trim($derivedKey); I get users/user). I get a bunch of coding errors stating that the file could not be loaded. I tried messing with the string types: object, string. Is there anything that I can do that'll make this derived key instantiate the xml file connection? PLEASE HELP!!!!!!!!! THank you sooo much! Alex
  22. <? $string='http://www.website.com/uploads/Dzi1NLoOBIUhWtd/c6 dyno predator before and after.jpg'; $explode = explode(" ", $string); $string_rw = ''; for($i=0; $i<count($explode); $i++){ if($i>0){ $string_rw .= "%20"; } $string_rw .= $explode[$i]; } $new_string = $string_rw; echo $new_string; ?>
  23. You can use either one. It really doesn't matter. I guess maybe I just like to keep stuff in a organized coherent fashion, aligning alike terms together. However, you can use either a constant or an array.
×
×
  • 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.