Jump to content

arianhojat

Members
  • Posts

    235
  • Joined

  • Last visited

    Never

Everything posted by arianhojat

  1. I want to make sure there are no duplicates of certain photographs uploaded to my site. Can I use md5() on a photograph's data and then store that value in the database. And when another user uploads an image, I can do an md5() on that and compare that md5 to others in the database. if they are the same, then delete the 2nd pic. My friend said using md5 on an image was pretty much very unique. Basically I want to ensure another user doesnt submit same photographs. so if you know any other way, or know previous method wont work, let me know. PS i might be getting hundreds of photographs a day so I cant check each one manually and compare to each other one. Thanks in advance!
  2. the next row. pretend row currently is row=5 then SELECT rowID from theTable WHERE rowID > 5 LIMIT 1 should get next highest rowID by getting all rows higher than 5, but only pulling 1st row. if returns a row, then put a button, if doesnt, dont include Next Image button.
  3. using php? can use in variable right after insert... mysql_insert_id() or return it from another query after previous Insert query if not using php. SELECT LAST_INSERT_ID() as lastRow;
  4. Seems like windows was the problem and not that bug in the code itself. Windows was acting weird lately. Services not being able to start because of permissions. not being able to delete files off and on because of permissions. problem would go away then come back. Even though i was an in Administrators group and tried Administrator account as well. same issues. made the c: drive definatively Full Control for me, same problem still so... reinstalled windows and i can install fine now.
  5. uh oh, the dreaded "double bump". dont want to open a new topic, although i imagine bumps are frowned upon so maybe i will do that if no answer.
  6. had question about References in the php manual.... class SimpleClass { // member declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this->var; } } $instance = new SimpleClass(); $assigned = $instance; $reference =& $instance; $instance->var = '$assigned will have this value'; $instance = null; // $instance and $reference become null var_dump($instance); var_dump($reference); var_dump($assigned); //prints out Now the manual seems to suggest u have to manually clone an object if you want to copy it to another variable by using clone() in php5, and just assigning a variable to an object, that it will make it a reference and not a copy. Is that really true? cause it seems to suggest u have to manually have to add &= for reference to work (unless use 'new' operator which automatically adds a &=). $assigned seems to have cloned its own copy of $instance without using clone().
  7. Can u just put on review.php a hyperlink that says Delete and the link they go to is like echo '<a href="review.php?recordID='.$recordID.'&ID='.$ID; and then u can look in $_GET['recordID'] and $_GET['ID'] for the variables. and on review.php, if both of those are set, delete the record with ID=$_GET['recordID'] be4 u build the html page. OR u can set forms action <form action="get".... and when they click submit button, the query string will be built for u. and u can look in $_GET['recordID'] and $_GET['ID'] for the variables as well. and on review.php, if both of those are set, delete the record with ID=$_GET['recordID'] be4 u build the html page.
  8. since its a pear function doesnt it also need a DB::dbquery("SELECT * FROM users WHERE username='$usern'"); ???
  9. <input type="hidden" name="amount" value="<?php echo $amount; ?>"> btw asp style tags <? ?> sometimes arent enalbed by default on server if u set up your own php server. anyway use <?php ?> more portable
  10. isnt it just a simple echo of the $total_price inside that function? <input type="hidden" name="amount" value="<?php echo $total_price; ?>"> Got to also make sure that function has access to that variable by declaring you want the global inside the function. You do that in display_cart but I dont know why u didnt in display_checkout_form() global $total_price;
  11. You can make a multiD array this way with that info and loop through it: $sql = mysql_query("SELECT crt, image, day(data) AS day FROM calendar WHERE image>0 and month(data) = '$month' AND year(data) = '$year'"); while ($row = mysql_fetch_array($sql)) { $dayNum =[$row['day']; $days[$dayNum] = $row['crt']; } foreach($days as $key=>$value) { echo $key .'_'. $month .'_'. $value .'.jpg'; //shout output 13_2_1.jpg format }
  12. i can try to install one of those prebundled ones although i prefer not to. Ill try later installing from wampserver.com when get back from work and give you an update.
  13. 1st of all, use $_POST ($HTTP_POST_VARS is more old school). So in the html have a <select name="products[]" multiple="multiple">.... then in php part of code... <?php //connect to database $host = "localhost"; $user = "myusername"; $pass = "mypassword"; $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect"); ... $products = $_POST['products']; // refers to the products[] array which returns chosen items in multiple select list foreach($products as $value) { //echo $value; //insert query into database $Query = "INSERT INTO documents.doc_owners ( productID, wantsIt ) VALUES ('. $value .' ,'Y')"; $result = mysql_query($Query) or die ("Error in query: $Query. ". mysql_error()); } ?> you could also build a 1 insert query string by looping through all the select list, and then ryunning that 1 query as well.
  14. I'm not sure then, u said there were 2 versions of php's on the box, is there a php.ini for each? i'll let someone else tackle this one.
  15. is php.ini set to load that extension? and is extension_dir pointing to where mysql.so in php.ini as well?
  16. Basically have this bug... http://bugs.mysql.com/bug.php?id=14649&thanks=3&notify=711 When installing MYSQL5.0.27 or 5.1.14 beta, i get this message at the end when doing the MySQL Instance Configuration... MySQLInstanceConfig.exe fails with the following error (from the instance configuration log file) when trying to write the my.ini file: Configuration file template C:\MySql5\my-template.ini could not be processed and written to C:\MySql5\my.ini. Error code -1. Not sure Why my install keeps failing, I am runing a E6600 Dual Core, XP Pro, 2gigs RAM, machine and downloading standard MYSQL5.0.27, am i doing anything wrong? Like maybe cause dual core chips have that 'extended 64 bit' support, should i theoretically compile a custom binary for my system since those binaries for for 32 bit, or doesnt matter? Thanks in advance, Been stuck on this problem for past month, Cant figure it out, googling doesnt help either. Arian
  17. i just would like to know the reason why it would create 'multiple copies of the object'. just practicing my theorizing to udnerstand how they probably did the php 4 code. thanks anyway. i guess php4 is old and shouldnt bother with understanding it.
  18. i was reading a php tutorial on this site and wanted to understand why in php4 u had to use pass by reference when creating an object?... like so... "$someVariable = &new SomeClass; Note: PHP 4 requires that you use return by reference (&) to avoid multiple copies of the object." i was wondering exactly why pass by reference was needed and not anymore. All i know about 'pass by reference' is that for example when u pass an object with it to a function, it passes a reference to the object so function can modified it. In PHP4, when objects were created on the right hand side with new SomeClass, did the left hand side not know to take in that exact object reference? like Did it pass a copy of it to it, hence creating 2 objects and only the copied one is referenced, the other orig one lies somewhere in memory? (those are the lines of thinking i am trying to figure out why it was needed, so if you can help out, thanks!)
  19. <?php $foo = array("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each($foo); print_r($bar); echo "\n\n"; //So this shows that each() returns a 4 element array so if you supposedly pass it to list() with 4 arguements within list(), how come only the index keys from the array created by each() only come over? reset($foo); //start array pointer back to beginning since called each() be4 while ( list($key, $val, $assosKey, $assocVal) = each($foo) ) echo "$key => $val (or $assosKey => $assocVal)\n"; //only prints out index values, but not the associative key/value pairs returned by the array. //Is it cause they one points to same place in memory really, so one is really a reference to the other? //or the list function only can take the index keys? ?> 
  20. Coulda swore I read that some white-hat 'hack' article couple months ago. Was explaining to my boss, but wanted to forward the article for backup. It was something about putting php code within the image metadata/comments i think and somehow the server runs it. Seemed scary at the time. Dont worry not going to use it, just curious. Tried googling 'run php code in image' couldnt find anything, but i remember a related article. Thanks, Arian
×
×
  • 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.