Jump to content

steviez

Members
  • Posts

    382
  • Joined

  • Last visited

    Never

Everything posted by steviez

  1. Hi, I am developing a script that needs a script to run every 24hrs to reset limits but i need it to hapen even if the user forgets or neglets to make the cron command. Is there anything that php can do to simulate cron? Thanks
  2. thanks for all your help guys, i have got it working now
  3. Hi, I am developing a new image hosting script for my site and would like to track the bandwidth each image uses, Is there a way to do this in PHP and if so can someone please point me in the right direction Thanks
  4. Not true, Smarty is a great system. =/ Quite honestly, this is an HTML problem. is it?
  5. I have no choice but to use it as im going to be selling the script and users need to be able to change the layout.
  6. Hi, I am designing my site using the smarty template system and need to display my results in a horizontal way instaed of them just going down the page. Here is my code so far: PHP side: <?php $result = mysql_query("SELECT * FROM uploads WHERE owner = '".$_SESSION['username']."' AND album_id = '".$_GET['galleryID']."'"); while($row = @mysql_fetch_array($result)) $results[] = $row; $smarty->assign("results",$results); ?> Template side: <table class="gallery" align="center" border="0"> <tbody align="center"> <tr align="center"> {foreach from=$results item="row"} <td align="center"><div id="img_{$row.id}" class="image" style="text-align: center; margin: 0 auto;"> <div class="image"> <a href="#"><img src="{$site_url}/images/{$row.file_name}" border="0" alt="" id="{$row.id}" style="max-width: 250px;"></a> </div> <div style="clear: both; text-align: left"></div> <span class="pseudolink" onClick="delImage({$row.id})">delete</span> / <span class="pseudolink" id="clk_{$row.id}" onClick="toggleStg(event, {$row.id})">move</span> <div id="stg_{$row.id}" class="settings" style="display: none; text-align: left"> <nobr><b>Move to album:</b></nobr><br> <span class="pseudolink" onClick="xajax_moveImage({$row.id}, {$row.id})">{$gi.title}</span><br /> </div> </div> </td> {/foreach} </tr> </tbody> </table> Any help would be great!
  7. Hi, I have no knowlage at all, i would not even know where to start Thanks
  8. Hi, On my site i have a pm system where users can contact each other. What i want to do is this: When a user types in the name of the person they want to pm i want it to bring up their profile picture at the side of the form. If this is possable can anyone show me an example? Thanks
  9. no, a user pastes a link in the upload box and presses upload and it uploads it from a remote site (URL Upload)
  10. Hi, Does anyone know how to make a file upload from a url (remote upload)? I have looked all over the net but cant seem to find much help. Thanks
  11. That seems to have worked thanks, what does the @ symble do at the beggining of php code?
  12. Hi, I need to show a image inline on a php page so im using the following code: <?php header('Content-Type: image/gif'); header('Content-Disposition: inline; filename=file_not_found.gif'); readfile("/home/image/public_html/images/file_not_found.gif"); ?> Even though the image is there and the image displays correctly im getting the following error: [09-Jul-2008 16:41:01] PHP Warning: readfile(/home/image/public_html/images/ewz8q9lvspdfevpc0k3.jpg) [<a href='function.readfile'>function.readfile</a>] Any ideas whats wrong? Thanks
  13. steviez

    query help

    Hi, I have a number of search option on my search form and some are from table one and some from table two. How do i join the following query so that if someone searches for something that is on table one it will return that value? $res = mysql_query("SELECT * FROM table 1, table 2 WHERE user_privacy_search = '0' AND " . implode(' AND ', $whereClauses) . "LIMIT $from, $max_results");
  14. i cant get this to work here is my code: <?php if (isset($_POST['Submit'])) { $whereClauses = array(); if ($_POST['eye_color']) { $whereClauses[] = "eye_color='{$_POST['eye_color']}'"; } if ($_POST['hair_color']) { $whereClauses[] = "hair_color='{$_POST['hair_color']}'"; } if ($_POST['age']) { $whereClauses[] = "age='{$_POST['age']}'"; } $query = "SELECT username, profile_picture FROM members WHERE " . implode(' AND ', $whereClauses); #$result = mysql_query($query); $results = 1; } <?php if($results == 1 || $no_results == 1){ ?> <!-- Begin Search Results --> <div class="box"> <table width="100%" border="0"> <tr> <td><img src="./images/search_results.gif" alt="Search Results" width="265" height="30" /></td> </tr> </table> <table width="100%" border="0"> <tr> <td align="center"> <?php if(!isset($_GET['page'])) { $page = 1; }else{ $page = $_GET['page']; } $max_results = 28; $from = (($page * $max_results) - $max_results); $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM members WHERE user_privacy_search = '0'"),0); $total_pages = ceil($total_results / $max_results); if($page > 1) { $prev = ($page - 1); echo "<input type=\"button\" class=\"prevbutton\" onClick=\"parent.location='".site_url."/index.php?gtaction=members.Search&page=$prev&token=".rand_token()."'\" title=\"Previous\" /> "; } if($page < $total_pages){ $next = ($page + 1); echo "<input type=\"button\" class=\"nextbutton\" onClick=\"parent.location='".members_url."/index.php?gtaction=members.Search&page=$next&token=".rand_token()."'\" title=\"Next\" />"; } ?> </td> </tr> <tr> <td> </td> </tr> <tr> <td align="center"> <?php define ("NUMCOLS",7); $res = mysql_query($query); $count = 0; echo "<table width=\"100%\" border=\"0\">\n"; while(list($col1, $col2) = mysql_fetch_row($res)){ if($count % NUMCOLS == 0) echo "<tr>\n"; # new row if($col2 == "") { $pic = "../images/nophoto.gif"; }else{ $pic = $col2; } echo "<td class=\"sc_text\" width=\"120\">$col1<br /><a href=\"".site_url."/$col1\"><img src=\"".$pic."\" border=\"0\" alt=\"\" width=\"100\" height=\"100\" class=\"photo\" /></a></td>\n"; $count++; if($count % NUMCOLS == 0) echo "</tr>\n"; # end row }# end row if not already ended if($count % NUMCOLS != 0){ while($count++ % NUMCOLS) echo "<td> </td>"; echo "</tr>\n"; } echo "</table>"; ?> </td> </tr> <tr> <td> </td> </tr> <tr> <td align="center"> <?php if($page > 1) { $prev = ($page - 1); echo "<input type=\"button\" class=\"prevbutton\" onClick=\"parent.location='".site_url."/index.php?gtaction=members.Search&page=$prev&token=".rand_token()."'\" title=\"Previous\" /> "; } if($page < $total_pages){ $next = ($page + 1); echo "<input type=\"button\" class=\"nextbutton\" onClick=\"parent.location='".members_url."/index.php?gtaction=members.Search&page=$next&token=".rand_token()."'\" title=\"Next\" />"; } ?> </td> </tr> </table> </div> <!-- End Search Results --> <?php } ?> ?>
  15. Hi, I want to creat a class/function so that i can show errors like this: <?php echo $error->showError['My error here']; ?> How would i do it?
  16. Hi, My host has just susspended my account for overloading the cpu with my script, the only active PHP code i have at the moment is a random array that returns a image randomly on the front page. Can you please have a look and tell me if it would be causing the overload? Code: <?php // Throw out a random image $pic = array("front_pic_1.jpg"=>"Front_Pic_1","front_pic_2.jpg"=>"Front_Pic_2","front_pic_3.jpg"=>"Front_Pic_3","front_pic_4.jpg"=>"Front_Pic_4","front_pic_5.jpg"=>"Front_Pic_5"); print_r(array_rand($pic,1)); ?> Thanks
  17. oOOooOPs i have fixed it the database table was named wrong
  18. Hi, I keep getting this error in my script: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/****/public_html/register.php on line 62 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/****/public_html/register.php on line 92 Here is the code in question: <?php // Check That Email Is Not In Use $check = "SELECT email FROM members WHERE email = '".$_POST['email']."'"; $qry = mysql_query($check); if(mysql_num_rows($qry) !== 0) { $error = 1; $error_message = "The email address you have entered is already in use, please use a different email address or login to your existing account."; } // Check That Username Is Not In Use $check = "SELECT username FROM members WHERE username = '".$_POST['username']."'"; $qry1 = mysql_query($check); if(mysql_num_rows($qry1) !== 0) { $error = 1; $error_message = "The username you have chosen is in use by another member, please choose a new username."; } ?> Any ideas?
  19. Hi, On my site i have a search form that allows users to search for people on the site. I have several search options (eg. age, eye color, hair color) How would i build a search query to search the database with the given posted data from the search form? Thanks
  20. I used this one: http://www.webmasters-central.com/t/cron.shtml It did the trick for what i wanted.
  21. got it sorted now all i did was remove the session_start() and just query the database for all online users that were idel. Thanks for al your help guys!
×
×
  • 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.