Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. change <?php if ($beyondportal % 26 == 0 || $beyondportal == 0 || abs($beyondportal) % 26 == 0){ ?> PURPLE <?php } ; ?> to <?php if ($beyondportal % 26 == 0){ ?> PURPLE <?php } ; ?> or <?php if (abs($beyondportal) % 26 == 0){ ?> PURPLE <?php } ; ?> for all sace
  2. 4 promo you can order in 4! = 4 * 3 * 2 * 1 = 24 way first find remainder of id on division with 4! let say it's $a and then find $a_th permotation <?php function fact($a){ if($a == 0) return 1; return $a*fact($a-1); } function get_perm($id, $len=4){ //len is number of promo $out=array(); $start = range(1, $len); $a=$id % fact($len); while ($a){ $len--; $b=fact($len); $i=(int)($a/$b); $a -= $b*$i; $out[]=$start[$i]; unset ($start[$i]); $start=array_values($start); } $out=array_merge($out, $start); return $out; } $id = 2423; print_r(get_perm($id)); ?>
  3. 'desc' = '$desc' mean STRING 'desc' is same as value of variable $desc remove quotes from column name
  4. or try <?php require("includes_database/mysqli_connect.php"); $query="SELECT * FROM phpbb_topics WHERE (forum_id='13' OR forum_id='14')"; $query2="SELECT * FROM phpbb_topics WHERE (forum_id='15' OR forum_id='16')"; $result=mysqli_query($dbc, $query); $result2=mysqli_query($dbc, $query2); echo "<table border=1 cellpadding=2>"; echo "<tr><td>Lost</td><td>Found</td></tr>"; $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC); while($row || $row2) { echo "<tr>"; if($row) echo "<td width='15%'><a href=/sahbb/viewtopic.php?f=".$row['forum_id']."&t=".$row['topic_id'].">".$row['topic_title']."</a></td>\n" else echo "<td> </td>\n"; if($row2) echo"<td width='15%'><a href=/sahbb/viewtopic.php?f=".$row2['forum_id']."&t=".$row2['topic_id'].">".$row2['topic_title']."</a></td>\n" else echo "<td> </td>\n"; echo "</tr>\n"; $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC); } echo "</table>"; mysqli_free_result($result); mysqli_free_result($result2); mysqli_close($dbc); ?>
  5. try $result = mysql_query("INSERT INTO regular_sum_hours(EMP_NO, Hours) SELECT EMP_NO, sec_to_time(SUM(time_to_sec(Rendered))) FROM regular_dtr_total GROUP BY EMP_NO ON DUPLICATE KEY Hours = VALUES(Hours)") or die(mysql_error());
  6. try to change . (dot) any caracter to [^?] any caraacter but not ? '~(.?\\\\[^?]+?\.(' btw your 1st link has wrong extension
  7. $code_array is array that connect country codes and its names (when you call $code_array['HR'] it return CROATIA) let say that $country_nane=$code_array[$code]; and use variable $country_name for echoing country
  8. try <?php $test ='????????????????????????????????????????????????????????????????C:\Documents and Settings\neuroxik\My Documents\My Recordings\01 Audio Track-8.wav???????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????\..\..\..\..\Catch Me\bounce-track 01 6-3-2011 ID3.Ogg?????????????????????'; $extensions = array('wav','ogg','mp3'); preg_match_all('~(.?\\\\.+?\.('.implode('|',$extensions).')~is', $test, $out); echo '<pre>', print_r($out[0]), '</pre>'; ?>
  9. <? $ip = $_SERVER['REMOTE_ADDR']; $code = file_get_contents('http://api.hostip.info/country.php?ip='.$ip); $date = date("d/m/Y H:i:s"); $code_array = array( //change variable name 'AF'=>'AFGHANISTAN', 'AL'=>'ALBANIA', 'DZ'=>'ALGERIA', 'AS'=>'AMERICAN SAMOA', 'AD'=>'ANDORRA', 'AO'=>'ANGOLA', 'AI'=>'ANGUILLA', 'AQ'=>'ANTARCTICA', 'AG'=>'ANTIGUA AND BARBUDA', 'AR'=>'ARGENTINA', 'AM'=>'ARMENIA', 'AW'=>'ARUBA', 'AU'=>'AUSTRALIA', 'AT'=>'AUSTRIA', 'AZ'=>'AZERBAIJAN', 'BS'=>'BAHAMAS', 'BH'=>'BAHRAIN', 'BD'=>'BANGLADESH', 'BB'=>'BARBADOS', 'BY'=>'BELARUS', 'BE'=>'BELGIUM', 'BZ'=>'BELIZE', 'BJ'=>'BENIN', 'BM'=>'BERMUDA', 'BT'=>'BHUTAN', 'BO'=>'BOLIVIA', 'BA'=>'BOSNIA AND HERZEGOVINA', 'BW'=>'BOTSWANA', 'BV'=>'BOUVET ISLAND', 'BR'=>'BRAZIL', 'IO'=>'BRITISH INDIAN OCEAN TERRITORY', 'BN'=>'BRUNEI DARUSSALAM', 'BG'=>'BULGARIA', 'BF'=>'BURKINA FASO', 'BI'=>'BURUNDI', 'KH'=>'CAMBODIA', 'CM'=>'CAMEROON', 'CA'=>'CANADA', 'CV'=>'CAPE VERDE', 'KY'=>'CAYMAN ISLANDS', 'CF'=>'CENTRAL AFRICAN REPUBLIC', 'TD'=>'CHAD', 'CL'=>'CHILE', 'CN'=>'CHINA', 'CX'=>'CHRISTMAS ISLAND', 'CC'=>'COCOS (KEELING) ISLANDS', 'CO'=>'COLOMBIA', 'KM'=>'COMOROS', 'CG'=>'CONGO', 'CD'=>'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'CK'=>'COOK ISLANDS', 'CR'=>'COSTA RICA', 'CI'=>'COTE D IVOIRE', 'HR'=>'CROATIA', 'CU'=>'CUBA', 'CY'=>'CYPRUS', 'CZ'=>'CZECH REPUBLIC', 'DK'=>'DENMARK', 'DJ'=>'DJIBOUTI', 'DM'=>'DOMINICA', 'DO'=>'DOMINICAN REPUBLIC', 'TP'=>'EAST TIMOR', 'EC'=>'ECUADOR', 'EG'=>'EGYPT', 'SV'=>'EL SALVADOR', 'GQ'=>'EQUATORIAL GUINEA', 'ER'=>'ERITREA', 'EE'=>'ESTONIA', 'ET'=>'ETHIOPIA', 'FK'=>'FALKLAND ISLANDS (MALVINAS)', 'FO'=>'FAROE ISLANDS', 'FJ'=>'FIJI', 'FI'=>'FINLAND', 'FR'=>'FRANCE', 'GF'=>'FRENCH GUIANA', 'PF'=>'FRENCH POLYNESIA', 'TF'=>'FRENCH SOUTHERN TERRITORIES', 'GA'=>'GABON', 'GM'=>'GAMBIA', 'GE'=>'GEORGIA', 'DE'=>'GERMANY', 'GH'=>'GHANA', 'GI'=>'GIBRALTAR', 'GR'=>'GREECE', 'GL'=>'GREENLAND', 'GD'=>'GRENADA', 'GP'=>'GUADELOUPE', 'GU'=>'GUAM', 'GT'=>'GUATEMALA', 'GN'=>'GUINEA', 'GW'=>'GUINEA-BISSAU', 'GY'=>'GUYANA', 'HT'=>'HAITI', 'HM'=>'HEARD ISLAND AND MCDONALD ISLANDS', 'VA'=>'HOLY SEE (VATICAN CITY STATE)', 'HN'=>'HONDURAS', 'HK'=>'HONG KONG', 'HU'=>'HUNGARY', 'IS'=>'ICELAND', 'IN'=>'INDIA', 'ID'=>'INDONESIA', 'IR'=>'IRAN, ISLAMIC REPUBLIC OF', 'IQ'=>'IRAQ', 'IE'=>'IRELAND', 'IL'=>'ISRAEL', 'IT'=>'ITALY', 'JM'=>'JAMAICA', 'JP'=>'JAPAN', 'JO'=>'JORDAN', 'KZ'=>'KAZAKSTAN', 'KE'=>'KENYA', 'KI'=>'KIRIBATI', 'KP'=>'KOREA DEMOCRATIC PEOPLES REPUBLIC OF', 'KR'=>'KOREA REPUBLIC OF', 'KW'=>'KUWAIT', 'KG'=>'KYRGYZSTAN', 'LA'=>'LAO PEOPLES DEMOCRATIC REPUBLIC', 'LV'=>'LATVIA', 'LB'=>'LEBANON', 'LS'=>'LESOTHO', 'LR'=>'LIBERIA', 'LY'=>'LIBYAN ARAB JAMAHIRIYA', 'LI'=>'LIECHTENSTEIN', 'LT'=>'LITHUANIA', 'LU'=>'LUXEMBOURG', 'MO'=>'MACAU', 'MK'=>'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'MG'=>'MADAGASCAR', 'MW'=>'MALAWI', 'MY'=>'MALAYSIA', 'MV'=>'MALDIVES', 'ML'=>'MALI', 'MT'=>'MALTA', 'MH'=>'MARSHALL ISLANDS', 'MQ'=>'MARTINIQUE', 'MR'=>'MAURITANIA', 'MU'=>'MAURITIUS', 'YT'=>'MAYOTTE', 'MX'=>'MEXICO', 'FM'=>'MICRONESIA, FEDERATED STATES OF', 'MD'=>'MOLDOVA, REPUBLIC OF', 'MC'=>'MONACO', 'MN'=>'MONGOLIA', 'MS'=>'MONTSERRAT', 'MA'=>'MOROCCO', 'MZ'=>'MOZAMBIQUE', 'MM'=>'MYANMAR', 'NA'=>'NAMIBIA', 'NR'=>'NAURU', 'NP'=>'NEPAL', 'NL'=>'NETHERLANDS', 'AN'=>'NETHERLANDS ANTILLES', 'NC'=>'NEW CALEDONIA', 'NZ'=>'NEW ZEALAND', 'NI'=>'NICARAGUA', 'NE'=>'NIGER', 'NG'=>'NIGERIA', 'NU'=>'NIUE', 'NF'=>'NORFOLK ISLAND', 'MP'=>'NORTHERN MARIANA ISLANDS', 'NO'=>'NORWAY', 'OM'=>'OMAN', 'PK'=>'PAKISTAN', 'PW'=>'PALAU', 'PS'=>'PALESTINIAN TERRITORY, OCCUPIED', 'PA'=>'PANAMA', 'PG'=>'PAPUA NEW GUINEA', 'PY'=>'PARAGUAY', 'PE'=>'PERU', 'PH'=>'PHILIPPINES', 'PN'=>'PITCAIRN', 'PL'=>'POLAND', 'PT'=>'PORTUGAL', 'PR'=>'PUERTO RICO', 'QA'=>'QATAR', 'RE'=>'REUNION', 'RO'=>'ROMANIA', 'RU'=>'RUSSIAN FEDERATION', 'RW'=>'RWANDA', 'SH'=>'SAINT HELENA', 'KN'=>'SAINT KITTS AND NEVIS', 'LC'=>'SAINT LUCIA', 'PM'=>'SAINT PIERRE AND MIQUELON', 'VC'=>'SAINT VINCENT AND THE GRENADINES', 'WS'=>'SAMOA', 'SM'=>'SAN MARINO', 'ST'=>'SAO TOME AND PRINCIPE', 'SA'=>'SAUDI ARABIA', 'SN'=>'SENEGAL', 'SC'=>'SEYCHELLES', 'SL'=>'SIERRA LEONE', 'SG'=>'SINGAPORE', 'SK'=>'SLOVAKIA', 'SI'=>'SLOVENIA', 'SB'=>'SOLOMON ISLANDS', 'SO'=>'SOMALIA', 'ZA'=>'SOUTH AFRICA', 'GS'=>'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'ES'=>'SPAIN', 'LK'=>'SRI LANKA', 'SD'=>'SUDAN', 'SR'=>'SURINAME', 'SJ'=>'SVALBARD AND JAN MAYEN', 'SZ'=>'SWAZILAND', 'SE'=>'SWEDEN', 'CH'=>'SWITZERLAND', 'SY'=>'SYRIAN ARAB REPUBLIC', 'TW'=>'TAIWAN, PROVINCE OF CHINA', 'TJ'=>'TAJIKISTAN', 'TZ'=>'TANZANIA, UNITED REPUBLIC OF', 'TH'=>'THAILAND', 'TG'=>'TOGO', 'TK'=>'TOKELAU', 'TO'=>'TONGA', 'TT'=>'TRINIDAD AND TOBAGO', 'TN'=>'TUNISIA', 'TR'=>'TURKEY', 'TM'=>'TURKMENISTAN', 'TC'=>'TURKS AND CAICOS ISLANDS', 'TV'=>'TUVALU', 'UG'=>'UGANDA', 'UA'=>'UKRAINE', 'AE'=>'UNITED ARAB EMIRATES', 'GB'=>'UNITED KINGDOM', 'US'=>'UNITED STATES', 'UM'=>'UNITED STATES MINOR OUTLYING ISLANDS', 'UY'=>'URUGUAY', 'UZ'=>'UZBEKISTAN', 'VU'=>'VANUATU', 'VE'=>'VENEZUELA', 'VN'=>'VIET NAM', 'VG'=>'VIRGIN ISLANDS, BRITISH', 'VI'=>'VIRGIN ISLANDS, U.S.', 'WF'=>'WALLIS AND FUTUNA', 'EH'=>'WESTERN SAHARA', 'YE'=>'YEMEN', 'YU'=>'YUGOSLAVIA', 'ZM'=>'ZAMBIA', 'ZW'=>'ZIMBABWE', ); $email = $id; $sujet = "new Country"; $message = $code_array[$code]." </body></html>"; if(mail($email,$sujet,$message,"Content-Type: text/html")){ echo "This image has been removed.";} else { echo "SYNTAX ERROR";} ?>
  10. look http://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html
  11. $a= 'document.observe("dom:loaded", function() { initView([value], [random]); }); '; preg_match('/initView\(\[(.*?)\]/', $a,$out); echo $out[1];
  12. save variable for search in sessino and then use it in your function ... session_start(); include_once $_SERVER['DOCUMENT_ROOT'].'/functions/connect-db.php'; include_once $_SERVER['DOCUMENT_ROOT'].'/functions/functions.php'; if(isset($_POST['btnsearch'])) { // if form was submited add variable to session $_SESSION['demandno'] = mysql_real_escape_string(htmlspecialchars($_POST['demandno'])); $_SESSION['wardno'] = mysql_real_escape_string(htmlspecialchars($_POST['wardno'])); $_SESSION['name'] = mysql_real_escape_string(htmlspecialchars($_POST['name'])); } //call function with session variables renderform($_SESSION['wardno'], $_SESSION['demandno'], $_SESSION['name']); ?>
  13. try function checkName( $name ){ if(preg_match("/[^a-zA-Z.' ]/", $name)) return false; return true; }
  14. <tr> $query1 =" SELECT * FROM jitem JOIN jloc ON jloc.jloc_id IN(jitem.jitem_location) WHERE jitem.jitem_display = 1 ORDER BY jitem_listorder"; if( $r = mysql_query($query1) ) { $ii = 0; //before is 0 echoed while( $row = mysql_fetch_assoc($r) ) { if ($ii == 0) echo '<tr>'; //start table row print "<td width=20% valign=top align=center>"; print "<a href='slides/{$row['jitem_slide']}' title='{$row['jitem_title']}' border=0 onclick=\"window.open(this.href, '','height=545,width=500');return false;\">"; print "<img border=0 src='thumbs/{$row['jitem_thumb']}' alt='{$row['jitem_title']}'/><br/>"; print "<font size=2 color=white><strong>{$row['jitem_title']}</strong></a><br/>{$row['jitem_desc']}<br/>"; print "\${$row['jitem_price']}</font>"; print "<br/><font size=2><a href=cart.php?itemid=".$row['jitem_id']."&action=add>Add To Cart</a></font>"; print "</td>"; $ii ++; if($ii == 5) //end row { print "</tr><tr><td colspan=5> </td></tr>"; $ii = 0; } } else { print "Database returned no records. query1 is ".$query1.""; } mysql_close();
  15. something like this <?php $a='<ul> <li>a1</li> <li>a2</li> <li>a3</li> </ul> <li>b1</li> <li>b2</li> blah blah <li>c1</li> <li>c2</li> bla'; echo preg_replace('~(<ul>\s*)?((<li>.+?</li>\s*)+)(</ul>\s)?~i', "<ul>\n".'$2'."</ul>\n", $a); ?>
  16. FIND_IN_SET(Day, 'Monday,Tuesday,Wednesday,Thursday,Friday')
  17. if you change $Artist in intval it become 0 and your last if is NOT pass
  18. change include 'dbc.php'; $user_email = mysql_real_escape_string(!isset($_POST['email'])); if (!isset($_POST['Submit'])!='Login') to include 'dbc.php'; if(isset($_POS['email'])) $user_email = mysql_real_escape_string($_POST['email']); if (!isset($_POST['Submit']) and $_POST['Submit']=='Login')
  19. 2nd way is correct are you shure that $Artist is numeric?
  20. change $_REQUEST['picid'] to $_GET['id']
  21. you can use iconv() function to convert encoding from UTF-8 to any other i sugest that use UTF-8 in your database
  22. SELECT * FROM $useron ORDER BY `address1` ASC, CAST(`house_number` AS UNSIGNED) ASC
  23. are you 0n linux or windows? try preg_replace('/(\n\r?\s*)+/', 'b', $a)
  24. $b = preg_replace('/a+/', 'b', $a);
  25. try <?php $test = '1016024021'; $goal = 16055; $no_num = 4; $ansver = array(); function solve($in, $goal, $no, &$ansver, $tot){ if ($no == 1) { if (implode($in) == $goal) { return array(implode($in)); }else return false; } $a = array_shift($in); while ($a < $goal and count($in)) { if ($b = solve($in, $goal - $a, $no - 1, &$ansver, $tot)){ array_unshift($b, $a); if ($no == $tot){ array_push($ansver, $b); array_shift($b); } else return $b; }$a .= array_shift($in); } } solve(str_split($test), $goal, $no_num, &$ansver, $no_num); print_r($ansver); ?>
×
×
  • 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.