Jump to content

AviNahum

Members
  • Posts

    170
  • Joined

  • Last visited

Everything posted by AviNahum

  1. i'm trying to create a function thats sorts 4 images from the highest one to the shortest one... // array of my images $images = array($proj['image1'], $proj['image2'], $proj['image3'], $proj['image4']); $sorted = array(0, 0, 0, 0); // put all heights in array for ($i=0; $i<4; $i++) { list($width, $height, $type, $attr) = getimagesize("admin/images/projects/".$images[$i]); $sorted[$i] = $height; } // sort it from the bigest number to the lowest rsort($sorted); // this gonna contain the sorted images $si = array(); for ($i=0; $i<4; $i++) { list($width, $height, $type, $attr) = getimagesize("admin/images/projects/".$images[$i]); for ($j=0; $j<4; $j++) { if ($sorted[$j] == $height) $si[$j] = $images[$i]; } } but if there two images with the same height, it's repeat this images few times... any ideas? Thanks!
  2. <?php error_reporting(E_ALL); $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Connection Error:' . mysql_error()); } mysql_select_db('catgories', $con); for($i=0;$i<=17659;$i++) { $query="INSERT INTO categories(products_id, categories_id) select $i,categories_id from categories"; mysql_query($query) or trigger_error("SQL: $query, ERROR: ", E_USER_ERROR); } ?>
  3. simply, $_GET['JobID']; echo $_GET['JobID'];
  4. I'm trying to build code that avoid spam comments on my site. I made a function that checks the last time the user commented, and if passed more than 30 seconds it allows them to comment again. i dont know why, but it's not work for me. this is the function: <?php public function check_spam() { global $core, $DB; //---------------------------------- // Select from DB the last reply //---------------------------------- $q4 = $DB->query("SELECT * FROM blog_articles_replies WHERE poster_ip='{$core->input['IP_ADDRESS']}' ORDER BY id DESC LIMIT 1"); $row = $DB->fetch_array($q4); //---------------------------------- // Format the time to seconds //---------------------------------- $last_post_date = $core->get_date($row['date'], "s"); $now_date = $core->get_date(time(), "s"); //---------------------------------- // Check if 30 seconds past //---------------------------------- if ( ($last_post_date+30) > $now_date ) { return TRUE; } else { return FALSE; } } ?> $core->input['IP_ADDREDD'] is the user IP ADDRESS; $core->get_date function: <?php public function get_date($date, $method="") { global $core; //---------------------------------- // Set an method if we didnt yet //---------------------------------- if ($method == "") { $method = "j/m/Y - G:i"; } //---------------------------------- // Returning //---------------------------------- return gmdate($method, $date); } ?> when i select 'DATE' from the DB, it's the miliseconds using time() function I tried to explain myself and my problem the best I can Thanks!
  5. ok, the problem on my server... thanks any way...
  6. i trying to get the user IP address with this code: $return['IP_ADDRESS'] = $_SERVER['REMOTE_ADDR']; echo $return['IP_ADDRESS']; but all i get is: ::1 i can't see any problems here. Thanks!
  7. what error you get? are you calling to these functions?
  8. give us a link to your page, or tell me in what line was the error?
  9. ummm i cant find any problems.... umm try to run this code and tell me if you get error: //displaying results echo " <div id='header'> <!--<h1>YellowPages</h1>--> <table border='0' width='100%'> <tr><td align='left'> <span><img src='images/banner_logo.png' alt='' /></span> </td><td> </td></tr></table> </div>"; include("navigation.php"); echo "<div id='content'> <div id='hspace'> <!-- horizontal space --> </div> <!-- horizontal space --> <table border='0' width='100%'> <tr> <td width='200px' valign='center' align='center'> <img src='images/contact.png' width='225px' alt='' />"; echo "</td> <td> <h2 class='title'>Number of businesses found: ".$totalResults." - Page ".$pageNum." of ".$totalPages."</h2> <div class='content'>"; /*if( $query == NULL ){ echo "SEARCH ERROR MESSAGE"; }else if ( strlen($city) == 0 && strlen($category) == 0 ){ echo "SEARCH ERROR MESSAGE CATEGORY"; }*/ //echo $query; i just removed the include ads.html if you dont get any error with this code, so the problem in your ads.html file...
  10. ok, this should work... //displaying results echo " <div id='header'> <!--<h1>YellowPages</h1>--> <table border='0' width='100%'> <tr><td align='left'> <span><img src='images/banner_logo.png' alt='' /></span> </td><td> </td></tr></table> </div>"; include("navigation.php"); echo "<div id='content'> <div id='hspace'> <!-- horizontal space --> </div> <!-- horizontal space --> <table border='0' width='100%'> <tr> <td width='200px' valign='center' align='center'> <img src='images/contact.png' width='225px' alt='' />"; include("ads.html"); echo "</td> <td> <h2 class='title'>Number of businesses found: ".$totalResults." - Page ".$pageNum." of ".$totalPages."</h2> <div class='content'>"; /*if( $query == NULL ){ echo "SEARCH ERROR MESSAGE"; }else if ( strlen($city) == 0 && strlen($category) == 0 ){ echo "SEARCH ERROR MESSAGE CATEGORY"; }*/ //echo $query;
  11. <?php $shopping_list = $_SESSION['wantlist']; ?> <?php echo "<pre>"; print_r($shopping_list); echo "</pre>"; ?> <table width="300" border="1" cellpadding="20"> <caption> My Bead Want List </caption> <?php foreach ($shopping_list as $key_1 => $val) { foreach ($val as $key_2 => $val_2) { echo('<tr> <td class="name">'.$shopping_list[$key_1][$key_2].'</td> <td class="thumbnail"><img width="87" height="87" src="'.$shopping_list[$key_1][$key_2].'" /></td> </tr>') ; } } ?> i'm not sure it will work...
  12. echo " <img src='stackm.jpg' id='Image2' alt='test!' onmouseover='ChgText({$number}); MM_swapImage('Image2','','stackmrollover1.jpg',1);' onmouseout='MM_swapImgRestore()'/> "; if this one not work, try this: echo " <img src='stackm.jpg' id='Image2' alt='test!' onmouseover='ChgText(".$number."); MM_swapImage('Image2','','stackmrollover1.jpg',1);' onmouseout='MM_swapImgRestore()'/> ";
  13. array( "file1.php" => "value", "file2.php" => "value", "file3.php" => "value", "file4.php" => "value", "file5.php" => "value", ); is this the way your array built?
  14. sorry, i dont really know how to work with XML...
  15. the [/b/] is not the part of his code, i think he added it in attempt to make the "include" bold so we can reconize it... but it's wont work in "code" tags...
  16. you get any error when you running this code? or you just dont see anything?
  17. <?php class person { public $name; public $age; public function __construct($n, $g) { $this->name = $n; $this->age = $g; } } $a = new person("my name" , "my age"); ?> it would nicer to work this way, right?
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $answers = array( array( //2+2 is what!!! 'isdisputed' => 'yes', 'answers' => array( '1' => array( 'propnum' => '4', 'grades' => '84,98,42,67', 'answer' => '5' ), '2' => array( 'propnum' => '10', 'grades' => '100,98,99,86,86,20,86,100,100,100', 'answer' => '4' ) ) ) ); $xw = new xmlWriter(); $xw->openMemory(); //use openUri() to output directly to a file $xw->startDocument('1.0', 'UTF-8'); $xw->startElement('share'); $xw->writeElement('page', 'page#'); $xw->writeElement('numsequence', 'numseq'); $xw->writeElement('publisher', 'pub'); $xw->writeElement('book', 'bookname'); foreach ($answers as $answer) { $xw->startElement('answer'); // $xw->writeElement('answernumber', $answer); $xw->writeElement('isdisputed', $answer['isdisputed']); foreach ($answers['answers'] as $disputedanswer) { $xw->startElement('disputedanswer'); $xw->writeElement('supporters', $disputedanswer['propnum']); $xw->writeElement('grades', $disputedanswer['grades']); $xw->writeElement('answer', $disputedanswer['answer']); $xw->endElement(); } } $xw->endElement(); //item echo $xw; ?> </body> </html>
  19. $query2 = "SELECT * FROM user WHERE username='{$_SESSION['username']}'"; change the username to the name of the colume in your DB
  20. if you got more questions, ask away...
  21. yes, you can use this method, easy and simple...
  22. i think the global variables are disabled in your server, you have to talk to your admin server and ask him to enable global vars option...
×
×
  • 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.