Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. use the code i posted, your code doesn't even query the database
  2. well each frame is a page, if that page has a refesh then it will only refesh itself not the whole page.. i'll like to pointout while this solution will work, i would recommend learning ajax as it would probably be better in the long run
  3. BUT... The script is creating a thumbnail file of the uploaded file, and i have no problem with the thumb file!! I can transfer it, change the chmod, etc... If everyone as read access to the uploaded file then you can create the thumbnail and do whatever you want to it, so Daniel0 could still be right, but as you have posted this problem before why start a new thread ? it just means we have less info now!
  4. try this $less = (float)$_POST['lessThan']; $most = (float)$_POST['greaterThan']; $_query = "SELECT SQL_CALC_FOUND_ROWS,* FROM products WHERE category LIKE '%category%' AND price BETWEEN $less AND $most COLLATE utf8_unicode_ci";
  5. the reason i said frames is because they are easy.. ajax would be better but its a larger learning curve.. with frames your have 3 files main.html <-- main container loads next two controls.php <-- controls to add text chatview.php <-- this you have your metatag <frameset rows="100px,*"> <frame name="control" src="controls.php"> <frame name="chat" src="chatview.php"> </frameset> *untested
  6. maybe consider ajax or frames, if you have the text entry, in one frame and the chat window in another you won't need to update the entry frame, either that or a javascript solution, not really php
  7. Humm, i think we skipped an issule here.. what type of problems is he causing, the last online game i created (some years ago), i offered an award for anyone who could find a cheat/exploit for the game, one person found a way of getting inf. money, my logs showed me what he was doing and i plugged the hole and removed the money he gained, he later told me a simple trick he found, which i plug and awarded him for letting me know. maybe pluging the problem would be better than removing him (well better still both)
  8. Blocking his IP, is very basic, blocking a range can hurt others.. when you check his ip, also check X-Forwarded-For as simple proxies use that for the client IP you can detect some proxies, and ban his ISP range, but i think a better solution would be to have the members signup (create an account) these account need to be activated (activation link sent to via email), while this won't stop him from setting up new email accounts it does slow them down, 10 minutes to create an account less than a minute to remove him can you PM his IP to me, i'll see if i can get the rang (don't post it publically, i don't think thats fair)
  9. //This sets the range to display in our query $min = $rows * ($pagenum - 1); to //This sets the range to display in our query $min = $page_rows * ($pagenum - 1);
  10. sasa is correct but personally i would do this:~ //This checks to see if there is a page number. If not, it will set it to page 1 if (empty($_GET['pagenum']) || $_GET['pagenum'] < 1 ) { $pagenum = 1; } else { $pagenum = (int)$_GET['pagenum']; // abstract var from link }
  11. can you post the full code and re-list the problems please,
  12. cont. from phorman post the fix <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); function query($query) { mysql_query($query); } $name = mysql_real_escape_string($_GET['name']); //Fix query("INSERT INTO table (col1, col2) VALUES ('Hello', '$name')"); mysql_close($con); ?>
  13. your doing an update not a select thus $rows['uname'] = null EDIT: try this (uses username instead) <?php include "config.php"; $tbl_name="user"; $username=$_SESSION['username']; $user_image = $rows['user_image']; $ext = findexts ($_FILES['user_image']['name']) ; #$new_name = $rows['uname']."."; $new_name = $username."."; //working replacement //This assigns the subdirectory you want to save into... make sure it exists! $target = "user_images/"; //This combines the directory, the random file name, and the extension $target = $target . $new_name.$ext; if(move_uploaded_file($_FILES['user_image']['tmp_name'], $target)) { //May need to add target to below (depends on other code) $sql=( "UPDATE $tbl_name SET user_image = '".$new_name.$ext."' WHERE uname='$username'"); $rows = mysql_query($sql); echo "The file has been uploaded as ".$new_name.$ext; #$id = $rows['id'];//pointless $id = mysql_insert_id(); echo $id; } else { echo "Sorry, there was a problem uploading your file."; } function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } ?>
  14. <?php require_once('config.php'); //line below replace $$ with && $pageNumber = (isset($_GET["page"]) && is_numeric($_GET["page"])) ? $_GET["page"] : 1; $perPage = 10; $padding = 5; $startIndex = ($pageNumber * $perPage) - $perPage; $totalCount = "SELECT COUNT(*) as 'Total' FROM clienti"; $rsCount = mysql_query($totalCount); $rowCount = mysql_fetch_object($rsCount); //-------- print "<div align=\"center\">"; print "Hello"; print "</div>"; $cerereSQL = 'SELECT * FROM clienti ORDER BY numefirpf ASC LIMIT $startIndex, $perPage'; $rezultat = mysql_query($cerereSQL); while($rand = mysql_fetch_array($rezultat)) { //print_r($rand); echo '<tr><td bgcolor="#d5ffef">'.$rand['numefirpf'].'</td>'; echo '<td bgcolor="#d5ffef">'.$rand['regcomcnp'].'</td>'; echo '<td bgcolor="#d5ffef">'.$rand['cifserienr'].'</td>'; echo '<td bgcolor="#d5ffef">'.$rand['adresa'].'</td>'; echo '<td bgcolor="#d5ffef">'.$rand['oras'].'</td>'; echo '<td bgcolor="#d5ffef">'.$rand['numepperc'].'</td>'; echo '<td bgcolor="#d5ffef">'.$rand['telefon'].'</td></tr>'; } ?>
  15. try the files outside Joomla they look fine (if they are in the same folder), except header("Location: http://www.g2motion.com"); will not work, you may want to use a JS or MetaTag Solution
  16. Not sure what your asking here, are message are being removed when they shouldn't be removed ? or the other way around ? EDIT: as a side note if your question is unclear many members will just ignore it.. as its going to be a pain to resolved
  17. Try these 2 examples <?php $data = file_get_contents("msgz.txt"); if(!empty($_POST['mesg'])) { $data = $data.$_POST['mesg']; file_put_contents("msgz.txt", $data); } ?> or this uses less memory <?php if(!empty($_POST['mesg'])) { $fp = fopen('msgz.txt', 'a'); //Appends Data fwrite($fp, $_POST['mesg']); fclose($fp); } ?>
  18. instead of using the http path use the file path ie $file = fopen(msgz.txt","r+"); or $file = fopen(dirname(__FILE__)."/msgz.txt","r+");
  19. not sure what you mean now.. <?php $result = mysql_query("SELECT * FROM table "); $cost = 0; while($row = mysql_fetch_array($result)) { $cost=$cost + $row['cost']; } echo $cost; ?> or <?php $result = mysql_query("SELECT *, SUM(cost) as total FROM table "); $cost = 0; while($row = mysql_fetch_array($result)) { echo "total = ".$row['total']; } ?>
  20. ok this is untested but may help <?php @include("contact/online_query.php"); //read system for Online Query system to be red, $form = "<form method=\"post\" action=\"online_query.php\"> <p align=\"center\"><font color=\"red\" size=\"3\"><b>Password for Administration :</b> <input name=\"password\" type=\"password\" size=\"10\"></font></p> <p align=\"center\"><input name=\"submit\" type=\"submit\" value=\"GO!\"></p> </form> "; if(isset($_POST["password"]) && $_POST["password"] == "my_password") { $_SESSION['access'] = "access"; } if($_SESSION["access"] == "access") { $dbfile = "database.txt"; $db = file_get_contents($dbfile); $db = explode("\n", $db); $decodedArray = array(); foreach($db as $dbitem) { $decodedArray[] = base64_decode(base64_decode($dbitem)); } //these are my two foreach foreach($decodedArray as $K => $decoded_entry) { echo $decoded_entry . "<a href='online_query.php?delete=" . $K . "'>[Delete!]</a>"; } //deleting code for Fsoft Software development personal website if(!empty($_GET["delete"])) { if(isset($decodedArray[$_GET["delete"]])) { unset($decodedArray[$_GET["delete"]]); } foreach($decodedArray as $k => $item) { $decodedArray[$k] = base64_encode(base64_encode($dbitem)); } $decoded = join("\n", $decodedArray); file_put_contents($dbfile, $decoded); } }else{ echo $form; } ?>
  21. without last ? does the end word work ? whats the problem with the backslashes ?
  22. okay to add it all up, try this <?php $result = mysql_query("SELECT * FROM table "); $cost = 0; while($row = mysql_fetch_array($result)) { $cost=$cost + $row['cost']; } ?>
  23. ahh okay try this preg_match('/^' . preg_quote($variant, '/') . '(?:\s|\?|,|!|\'|"|\.)?$/', $shebang
  24. Very close <?php $result = mysql_query("SELECT * FROM table "); $cost = array(); while($row = mysql_fetch_array($result)) { $cost[] =$row['cost']; } ?> i normally do this (may not work on yours) <?php $result = mysql_query("SELECT * FROM table "); $cost = array(); while($row = mysql_fetch_array($result)) { $cost[$row['uID']] =$row['cost']; //uID = my unique id } ?>
  25. Yes, something like that.. EDIT: Well done Solved? if so click solved please
×
×
  • 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.