Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try <?php $array = array('item1' => 'Item 1', 'item2' => 'Item 2', 'item3' => 'Item 3', 'item4' => 'Item 4', 'item5' => 'Item 5', 'item6' => 'Item 6', 'item7' => 'Item 7', 'item8' => 'Item 8', 'item9' => 'Item 9', 'item10' => 'Item 10', 'item11' => 'Item 11'); $num_of_list = 3; $total_item = count($array); $ends = array(0); while ($num_of_list > 0) { $a = ceil($total_item / $num_of_list); $ends[] = $a + max($ends); $total_item -= $a; $num_of_list--; } $i = 0; foreach ($array as $item){ if (in_array($i, $ends)) echo "<ul>\n"; $i++; echo "<li>$item</li>\n"; if (in_array($i, $ends)) echo "</ul>\n"; } ?>
  2. look http://www.phpfreaks.com/forums/index.php/topic,155530.0.html
  3. 'banner_type' can't be == 0 AND == 1 in same time if statement is allways false
  4. you have one $ much try ... foreach($actuals_array AS $name => $gross) { ${'movie_' . $rank . '_actual_name'} = $name; ${'movie_' . $rank . '_actual_gross'} = $gross; $rank--; }
  5. try <?php $result = ($imgname != "") ? dbquery("UPDATE ".$db_prefix."news SET news_subject='$news_subject', news_cat='$news_cat', news_picture='$imgname', news_news='$body', news_extended='$body2', news_breaks='$news_breaks',".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "")." news_start='$news_start_date', news_end='$news_end_date', news_visibility='$news_visibility', news_sticky='$news_sticky', news_allow_comments='$news_comments', news_allow_ratings='$news_ratings' WHERE news_id='$news_id'") : dbquery("UPDATE ".$db_prefix."news SET news_subject='$news_subject', news_cat='$news_cat', news_news='$body', news_extended='$body2', news_breaks='$news_breaks',".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "")." news_start='$news_start_date', news_end='$news_end_date', news_visibility='$news_visibility', news_sticky='$news_sticky', news_allow_comments='$news_comments', news_allow_ratings='$news_ratings' WHERE news_id='$news_id'");?>
  6. <?php function guidCheck($guid_uid) { $out = ''; $sql = "SELECT game FROM pb_guid WHERE uid = '".$guid_uid."' AND guid_status = '1' ORDER BY game DESC"; $result = mysql_query($sql); if(mysql_num_rows($result)!=0) { //(1) while(list($game) = mysql_fetch_row($result)) { //(2) $out .= "<img src=\"NukeLadder/images/guid_games/$game.gif\" alt=\"GuID Approved\" /> "; } } return $out; ?>
  7. try <form method="POST"> Start:<input type="text" name="start" /><br /> End:<input type="text" name="end" /><br /> <input type="submit" name="submit" value="submit" /> </form> <?php if ($_POST['submit']){ echo '<table border="3"><tr><td>ID</td><td>NAME</td></tr>'; for ($i = $_POST['start']; $i <= $_POST['end']; $i++) { $file = 'http://www.urbandead.com/profile.cgi?id='.$i; $a = file_get_contents($file); preg_match('/<span class="ptt">(.*)<\/span>/',$a,$b); echo "<tr><td>$i</td><td>{$b[1]}</td></tr>\n"; } echo '</table>'; } ?>
  8. try <input type="hidden" name="i" value="<?=$i?>" />
  9. preg_match_all("/var pageVideoId = '([^']+)/", $html, $headers);
  10. try $file_names=array('a.php','b.php','c.php'); $total = array(); foreach($file_names as $name){ include($name); $total[] = $mocks; }
  11. try <?php $type = stripslashes($row['type']); $related_games = mysql_query("SELECT `title` FROM `game` WHERE `type`= '{$type}' ORDER BY RAND('title') LIMIT 10") or die(mysql_error()); while($row2 = mysql_fetch_array($related_games)){ echo '<a href="game.php?title='; echo $row2[0]; echo '">'; echo $row2[0];//o<>0 echo '</a>'; echo '<br>'; } ?>
  12. try <a href="http://www.youtube.com/get_video<?php $html = implode('', file("http://youtube.com/watch?v=bcr6IBnuVHQ")); preg_match_all("/var fullscreenUrl = '\/watch_fullscreen([^']+)/", $html, $headers); echo $headers[1]."\n"; } ?>">Get Video</a>
  13. in source of your link i see <php $url = "http://youtube.com/watch?v=AhO5Pkm3k_8"; $web_page = file_get_contents($url); preg_match("/var fullscreenUrl = '\/([^']+)/",$web_page,$a); print_r($a); ?> <BR><BR><BR> <pre>w OR <br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home2/alabamaw/public_html/psp/youtube/test.php</b> on line <b>27</b><br /> OR w OR <br /> <b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in <b>/home2/alabamaw/public_html/psp/youtube/test.php</b> on line <b>41</b><br /> source code of script it is because PHP does not pharse it what the rest of script does?
  14. i try $url = "http://youtube.com/watch?v=AhO5Pkm3k_8"; $web_page = file_get_contents($url); preg_match("/var fullscreenUrl = '\/([^']+)/",$web_page,$a); print_r($a); it putput is Array ( [0] => var fullscreenUrl = '/watch_fullscreen?video_id=AhO5Pkm3k_8&l=9&t=OEgsToPDskLLZcUW8ZuGr37z_i-zsMBf&sk=Me5nFbc9_C4gD2CLqrGoGAC&fs=1&title=Boxer beats up frisbee [1] => watch_fullscreen?video_id=AhO5Pkm3k_8&l=9&t=OEgsToPDskLLZcUW8ZuGr37z_i-zsMBf&sk=Me5nFbc9_C4gD2CLqrGoGAC&fs=1&title=Boxer beats up frisbee )
  15. $tse_id = $_GET['id']; // you define $tse_id $result = mysql_query ("SELECT DATE_FORMAT(tse.tse_start, '%M %d, %Y') AS tse_start1, tse.tse_id, tse.tse_name, tse.tse_mentorname, tse.tse_mgr, tse.tse_grpid, DATE_FORMAT(tse.tse_vi3, '%M %d, %Y') AS tse_vi31, DATE_FORMAT(tse.tse_estlive, '%M %d, %Y') AS tse_estlive1, DATE_FORMAT(tse.tse_golive, '%M %d, %Y') AS tse_golive1, DATE_FORMAT(tse.tse_vcp, '%M %d, %Y') AS tse_vcp1, tse.tse_vcpver, tse.tse_ismentor, tse.tse_ismgr, tse.tse_level, tse.tse_weekorder, tse.tse_bootdone, sme.sme_id, sme.sme_name, mgmt.mgmt_id, mgmt.mgmt_name FROM tse, sme, mgmt, weeks, weekorder WHERE $id = tse.tse_id and sme.sme_id = tse.tse_grpid and mgmt.mgmt_id = tse.tse_mgr") or die(mysql_error()); // you use $id in your query you use variable $id that is not set yet
  16. try if(preg_match("/\\n/i", $strip_text))
  17. try <?php $var="http://www.com/"; //$var="http://www.phpfreaks.com/forums/index.php?action=post;topic=171945.0;num_replies=6"; preg_match('/([^\.\/]+\.[^\.\/]+)($|\/)/',$var,$out); echo $out[1]; ?>
  18. look trim() function
  19. try[code[<?php function my_comp($a, $b){ foreach ($a as $v) $x = strtolower($v); foreach ($b as $v) $y = strtolower($v); if ($x > $y) return 1; if ($x == $y) return 0; return -1; } $a = array(array(746=>"X some alphanumeric data"), array(747=>"F some alphanumeric data"), array(748=>"E some alphanumeric data"), array(749=>"ER some alphanumeric data"), array(750=>"some alphanumeric data"), array(751=>"lsqmdkd some alphanumeric data") ); usort($a, 'my_comp'); print_r($a); ?>
  20. SELECT ip, COUNT(id) FROM a_users GROUP BY ip HAVING COUNT(id) > 2
  21. try <?php session_start(); $IDs = range(1,10);// your ID array $randID = array(); $per_page = 3; if (isset($_SESSION['rID'])) $randID = $_SESSION['rID']; if (count($randID) < $per_page){ shuffle($IDs); $randID = array_merge($randID,$IDs); $randID = array_values(array_unique($randID)); } $curIDs = array(); for ($i = 0; $i < $per_page; $i++){ $curIDs[] = $randID[$i]; unset($randID[$i]); } $_SESSION['rID'] = array_values($randID); foreach ($curIDs as $v) echo $v, "<br />\n"; ?> <a href="">Next</a>
  22. try <?php $start_date = '7/1/2007'; $shift_cycle = array('C', 'A','B','C','A','D','C','D', 'B','C','D','B','A','D','A', 'C','D','A','C','B','A','B', 'D','A','B','D','C','B'); $today = date('m/d/y'); //$today = '12/29/2007'; //for testing echo 'Shift is ', $s = $shift_cycle[((strtotime($today) - strtotime($start_date))/(86400))%28]; ?>
  23. change ".$_POST['kills$username']." to ".$_POST["kills$username"]."
×
×
  • 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.