Jump to content

DarkPrince2005

Members
  • Posts

    307
  • Joined

  • Last visited

Everything posted by DarkPrince2005

  1. Can anyone help me? I am generating pagination links but i need them to fit into a table cell with a width of 200px, so i need the pagination to continue over into multiple lines. <table style="width:200px;padding:0px;border:0px;border-spacing:0px;border-collapse:collapse"> <?php if(isset($_GET)){ if(mysql_num_rows(mysql_query($sql)) < 1){ echo 'empty'; } else { $count = 1; $recordCount = 20; $page = isset($_GET["page"]) ? $_GET["page"] : 1; $page = $page < 1 ? 1 : $page; $limitFrom = (($page-1) * $recordCount); $limitTo = ($limitFrom + $recordCount) - 1; //view all the news articles in rows $sqlr = mysql_query($sql." LIMIT $limitFrom, $recordCount") or die(mysql_error()); //the total rows in the table $totalres = mysql_num_rows(mysql_query($sql)); //the total number of pages (calculated result), math stuff... $totalpages = ceil($totalres / $recordCount); while($row = mysql_fetch_array($sqlr)) { echo '<tr><td class="nr"><span>'.$count++.'</span></td><td class="latest" valign="center"><a href="#">'.htmlentities($row["name"]).'<br /><span class="song">'.htmlentities($row["track_name"]).'</span></a></td><td class="latest"><img src="admin/uploads/'.htmlentities($row["inmg"]).'" height="35" /></td></tr>'; } echo '<tr><td colspan="3" style="text-align:justify;width:200px;max-width:200px;"><br />'; if ($page > 1){ echo "<a href=\"genres2.php?page=".($page-1)."\" style='padding:0 3px'>Previous</a>";} else { echo "Previous";} for($i = 1; $i <= $totalpages; $i++){ //this is the pagination link echo "<a href='genres2.php?page=$i&genre=".$_GET["genre"]."' style='padding:0 3px;display:inline;'>$i</a>|"; } if ($page < $totalpages){ echo "<a href=\"manage_tracks.php?page=".($page+1)."\" style='padding:0 3px'>Next</a>";} else { echo "Next";} echo '</td></tr>'; } } else{ } ?> </table>
  2. I've got a form that is generated x-amount of times, x being selected from a drop down. But everytime the form is submitted and the forms don't validate the user has to re-enter all thee data. Does anyone know how I can make the form remember the $_POST values of an array. e.g. <input value="$_POST["name"]" /> <div name="students" id="students"> <table align=center border=0 cellspacing=4 cellpadding=0 width=700px> <input type="hidden" name="student_tot" value="1"> <tr> <td align="left" colspan="4">Student 1: <br><hr></td> </tr> <tr> <td><FONT color=#ff0000>*</FONT> Title</td> <td width="23%"><?drop_down(array("Mr","Mrs","Miss","Dr","Prof"), "s_title[]");?></td> <td width="27%"><FONT color=#ff0000>*</FONT> Last Name</td> <td width="23%"><input class=FrmTextBox style="width: 100%" name="s_surname[]"></td> </tr> <tr> <td ><FONT color=#ff0000>*</FONT> First Name</td> <td ><input class=FrmTextBox style="width: 100%" name="s_name[]"></td> <td><FONT color=#ff0000>*</FONT> Birthday</td> <td> <? drop_days1('s_bday[]', date('d',strtotime($date1))); echo " "; drop_months1("s_bmonth[]", "to_day", $date1); echo " "; drop_years1("s_byear[]", $date1); ?> </td> </tr> <tr> <td> ID Number</td> <td><input class=FrmTextBox style="width: 100%" name="s_ID[]"></td> <td rowspan="2" valign="top"><FONT color=#ff0000>*</FONT> Postal Address</td> <td rowspan="2"><textarea class=FrmTextBox style="width: 100%" name="s_address[]"></textarea></td> </tr> <tr> <td> Tel (W)</td> <td><input class=FrmTextBox style="width: 100%" name="s_tel_w[]"></td> </tr> <tr> <td> Tel (H)</td> <td><input class=FrmTextBox style="width: 100%" name="s_tel_h[]"></td> <td> Fax</td> <td><input class=FrmTextBox style="width: 100%" name="s_fax[]"></td> </tr> <tr> <td><FONT color=#ff0000>*</FONT> Email</td> <td><input class=FrmTextBox style="width: 100%" name="s_email[]"></td> <td><FONT color=#ff0000>*</FONT> Cell</td> <td><input class=FrmTextBox style="width: 100%" name="s_cell[]"></td> </tr> </table> </div>
  3. I hope that someone can help me. I am trying to change the text/value on a joomla language selection button upon language change. or just the default value. eg. to change French to francais.
  4. SELECT a.session_id, a.reference, a.payment_status, b.Session, b.Product_Description AS Product_Description, b.Product_Price AS Product_Price, b.Product_Quantity AS Product_Quantity, c.REF, d.file AS FILE , d.reference, d.dl_count AS dl_count, d.dl_date, d.dl_end AS dl_end FROM order_details a INNER JOIN cart b ON b.Session = a.session_id INNER JOIN products c ON c.REF = b.Product_Description INNER JOIN downloads d ON d.reference = a.reference WHERE d.reference = '".$_GET["Reference"]."' AND d.file = '".$_GET["file"]."' AND a.payment_status = '1' AND NOT isnull( d.dl_count ) AND d.dl_count != '0' and d.dl_end > NOW() LIMIT 1 It was an error in my query
  5. I can't see where the error in my logic might be...I've looked oer it countless times. <?php // Sample usage include "inc/config.php"; mysql_connect("$host","$user","$pass"); mysql_select_db("$dbase"); $date = date('Y-m-d H:i:s'); $check = mysql_query("select a.session_id,a.reference,a.payment_status, b.Session,b.Product_Description as Product_Description,b.Product_Price as Product_Price,b.Product_Quantity as Product_Quantity, c.REF,c.FILE as file, d.reference,d.file,d.dl_count as dl_count,d.dl_date,d.dl_end from order_details a inner join cart b on b.Session = a.session_id inner join products c on c.REF = b.Product_Description inner join downloads d on d.reference = a.reference where d.reference = '".$_GET["Reference"]."' and c.FILE = '".$_GET["file"]."' and a.payment_status = '1' and not isnull(d.dl_count) and d.dl_count != '0' and now() <= d.dl_end limit 1"); if(mysql_num_rows($check) > 0){ function sendTest() { $resultssss = $_GET["file"]; if(file_exists($resultssss)){ $res = sendFile($_GET["file"], 'application/octet-stream'); if ($fh = @fopen(dirname(__FILE__).'/result.txt','w')) { @fwrite($fh, var_export($res, true)); @fclose($fh); } } } // The sendFile function streams the file and checks if the // connection was aborted. function sendFile($path, $contentType = 'application/octet-stream') { ignore_user_abort(true); header('Content-Transfer-Encoding: binary'); header('Content-Disposition: attachment; filename="' . basename($path) . "\";"); header("Content-Type: $contentType"); $res = array('status'=>false,'errors'=>array(),'readfileStatus'=>null,'aborted'=>false); $res['readfileStatus'] = readfile($path); if ($res['readfileStatus'] === false) { $res['errors'][] = 'readfile failed.'; $res['status'] = false; } if (connection_aborted()) { $res['errors'][] = 'Connection aborted.'; $res['aborted'] = true; $res['status'] = false; } return $res; } // Save the status of the download to some place function saveDownloadStatus($res) { $ok = false; $fh = fopen('download-status-' . $_SERVER['REMOTE_ADDR'] . '-' . date('Ymd_His'), 'w'); if ($fh) { $ok = true; if (!fwrite($fh, var_export($res, true))) { $ok = false; } if (!fclose($fh)) { $ok = false; } } return $ok; } sendtest(); exit; } ?>
  6. OK, I'm producing a downlist from purchased records and inserting it into a downloads table with a expiry date into the dl_end field. and when the link is clicked it checks if the expiry date is before or after the current date. if the dl_end date is before the current date it does nothing. if it's after the download continues. But currently it downloads eveerytime.
  7. select a.session_id,a.reference,a.payment_status, b.Session,b.Product_Description as Product_Description,b.Product_Price as Product_Price,b.Product_Quantity as Product_Quantity, c.REF,c.FILE as file, d.reference,d.file,d.dl_count as dl_count,d.dl_date,d.dl_end from order_details a inner join cart b on b.Session = a.session_id inner join products c on c.REF = b.Product_Description inner join downloads d on d.reference = a.reference where d.reference = '".$_GET["Reference"]."' and c.FILE = '".$_GET["file"]."' and a.payment_status = '1' and not isnull(d.dl_count) and d.dl_count != '0' and d.dl_end > now() limit 1 I tried, and it doesn't work
  8. "select a.session_id,a.reference,a.payment_status, b.Session,b.Product_Description as Product_Description,b.Product_Price as Product_Price,b.Product_Quantity as Product_Quantity, c.REF,c.FILE as file, d.reference,d.file,d.dl_count as dl_count,d.dl_date,d.dl_end from order_details a inner join cart b on b.Session = a.session_id inner join products c on c.REF = b.Product_Description inner join downloads d on d.reference = a.reference where d.reference = '".$_GET["Reference"]."' and c.FILE = '".$_GET["file"]."' and a.payment_status = '1' and not isnull(d.dl_count) and d.dl_count != '0' and UNIX_TIMESTAMP(d.dl_end) > 'now()' limit 1" Can anyone tell me what I'm doing wrong? I'm trying to select every record after todays date.
  9. Greetings Boys and Girls I'm trying to limit the amount of downloads on a specific file. I've found the below script online to check if a file has been successfully downloaded, and then delete it from the downlloads table. but it seems to decriment the download count even if the download was not successful? any ideas...Please it's urgent. <?php // Sample usage include "inc/config.php"; mysql_connect("$host","$user","$pass"); mysql_select_db("$dbase"); $check = mysql_query("select a.session_id,a.reference,a.payment_status, b.Session,b.Product_Description as Product_Description,b.Product_Price as Product_Price,b.Product_Quantity as Product_Quantity, c.REF,c.FILE as file, d.reference,d.file,d.dl_count as dl_count,dl_date,dl_end from order_details a inner join cart b on b.Session = a.session_id inner join products c on c.REF = b.Product_Description inner join downloads d on d.reference = a.reference where d.reference = '".$_GET["Reference"]."' and a.payment_status = '1' and not isnull(d.dl_count) and d.dl_count != '0' limit 1"); if(mysql_num_rows($check) > 0){ function sendTest() { $resultssss = $_GET["file"]; if(file_exists($resultssss)){ $res = sendFile($_GET["file"], 'application/octet-stream'); if ($fh = @fopen(dirname(__FILE__).'/result.txt','w')) { @fwrite($fh, var_export($res, true)); @fclose($fh); } /*if ($res['status']) { echo 'Download succeeded'; } else { echo 'Download failed'; }*/ $sql = mysql_query("select a.session_id,a.reference, b.Session,b.Product_Description as Product_Description,b.Product_Price as Product_Price,b.Product_Quantity as Product_Quantity, c.REF,c.FILE as file, d.file,d.dl_count as dl_count,dl_date,dl_end from order_details a inner join cart b on b.Session = a.session_id inner join products c on c.REF = b.Product_Description inner join downloads d on d.reference = a.reference where a.reference = '".$_GET["Reference"]."' and a.payment_status = '1' and d.dl_count != 'NULL' and d.dl_count != '0' limit 1"); if(mysql_num_rows($sql)<1){ echo 'p'; } else { saveDownloadStatus($res); var_dump(saveDownloadStatus($res)) while($row = mysql_fetch_array($sql)){ mysql_query("UPDATE downloads set dl_count = ".($row["dl_count"]-1)." where reference = '".$_GET["Reference"]."'");} } } else{ echo 'bp'; } } // The sendFile function streams the file and checks if the // connection was aborted. function sendFile($path, $contentType = 'application/octet-stream') { ignore_user_abort(true); header('Content-Transfer-Encoding: binary'); header('Content-Disposition: attachment; filename="' . basename($path) . "\";"); header("Content-Type: $contentType"); $res = array('status'=>false,'errors'=>array(),'readfileStatus'=>null,'aborted'=>false); $res['readfileStatus'] = readfile($path); if ($res['readfileStatus'] === false) { $res['errors'][] = 'readfile failed.'; $res['status'] = false; } if (connection_aborted()) { $res['errors'][] = 'Connection aborted.'; $res['aborted'] = true; $res['status'] = false; } return $res; } // Save the status of the download to some place function saveDownloadStatus($res) { $ok = false; $fh = fopen('download-status-' . $_SERVER['REMOTE_ADDR'] . '-' . date('Ymd_His'), 'w'); if ($fh) { $ok = true; if (!fwrite($fh, var_export($res, true))) { $ok = false; } if (!fclose($fh)) { $ok = false; } } return $ok; } sendtest(); exit; } else { echo 'as'; } ?>
  10. <?php // NB Stuff - Same on all pages // include 'inc/db.php'; require('classes/class.database.php'); require('classes/class.session.php'); require('classes/class.users.php'); include 'classes/class.general.php'; $database = new Database($host,$user,$pass,$dbname); if (!$database->connect()) die('Could not resolve database'); $session = new Session; $page_title = "Manage Artists"; include 'inc/simple_forms.php'; // POST VARS TO PHP VARS $code = isset($_POST['code']) && $_POST['code'] !== '' ? $_POST['code'] : ''; $name = isset($_POST['name']) && $_POST['name'] !== '' ? $_POST['name'] : ''; $m_artist_add_form = ' <div class="m_artist_add_form"> <form method="post" enctype="multipart/form-data" action="manage_artists.php?add"> Artist Code: <input type="text" name="code" value="'.$code.'" /><br /> Artist Name: <input type="text" name="name" value="'.$name.'" /><br /> <input class="button" type="submit" name="submitted" value="Save"> </form> </div> '; // END of NB Stuff // // Check if logged in // if($session->logged_in) { if(isset($_POST["search"]) && $_POST["searchfield"] != ""){ $sql = "select * from artists where `name` like '%".$_POST["searchfield"]."%'"; echo $sql; $query = mysql_query($sql); if(mysql_num_rows($query)<1) { //$sql = "select * from `artists`"; if($query = $database->query($sql)) { $genre = mysql_query("select * from genre order by name"); include "inc/header.php"; ?> <table width="100%" cellpadding="5" cellspacing="0"> <tr><td align="left" bgcolor="#cccccc" height="22"> </td><td align="right" bgcolor="#cccccc" height="22"><span style="font-size:12px;">Search:</span> <input type="text" name="searchfield" /><input type="submit" name="search" value="Go" /></td></tr></table> <?php $result = $database->getRecordSet($sql); echo "<div class='list'><br /><br /><table cellpadding='1' cellspacing='0'>"; echo " <tr> <td width='4%'> </td> <td width='10%' class='bold'> Artist Code </td> <td width='20%' class='bold'> Artist Name </td> <td width='20%' class='bold'> Date Added </td> <td width='5%'> Edit </td> <td width='5%'> </td> </tr> <tr> <td colspan='6' align='center' height='30'>NO RESULTS FOUND</td> </tr> "; //close up the table echo "</table><br />"; exit; } }else{ include "inc/artists_search.php"; exit; } } if(isset($_POST["delete"])) { if($_POST["delete"] != ""){ $err = 0; foreach($_POST["delete"] as $key => $id) { $sql1=mysql_query("select * FROM artists WHERE id = '".(int)$id."' limit 0,1") or die(mysql_error("Error")); $a = mysql_fetch_array($sql1); $R=mysql_fetch_array($sql1); $sql=mysql_query("DELETE FROM artists WHERE id='".(int)$id."'") or die(mysql_error()); if(!$sql){ $err++; } } if($err==0) { header('Refresh: 2; url=manage_genres.php'); include 'inc/header.php'; echo $artists_mdelete_success; exit; } else { echo "Deletion failed"; var_dump($database->error()); } } else { echo "please select at least one row, to delete it"; } } if(isset($_GET['add'])) { // ADD NEW TRACK INCLUDE include 'inc/m_artists_add.php'; } elseif(isset($_GET['delete'])) { // DELETE TRACK INCLUDE include 'inc/m_artists_delete.php'; } else { // SHOW TRACKS LIST INCLUDE include 'inc/header.php'; echo '<form method="post" name="tracks" id="tracks" action="manage_artists.php"><a href="manage_artists.php?add">Add New</a>'; ?> <a href="javascript:;" onclick="submitform()">Delete Selected</a> <?php include 'inc/m_artists_list.php'; echo '</form>'; ?> <script type="text/javascript"> function submitform() { document.forms.tracks.submit(); } </script> <?php } $database->disconnect(); } else { // If not logged in include 'inc/header.php'; echo $login_msg; echo $login_form; } // End of logged in checking include 'inc/footer.php'; ?>
  11. it still isn't working... include 'inc/header.php'; echo '<form method="post" name="tracks" id="tracks" action="manage_artists.php"><a href="manage_artists.php?add">Add New</a>'; ?> <a href="javascript:;" onclick="submitform()">Delete Selected</a> <?php include 'inc/m_artists_list.php'; echo '</form>'; ?> <script type="text/javascript"> function submitform() { document.forms.tracks.submit(); } </script>
  12. Can anyone maybe tell me why the submit isn't working? include 'inc/header.php'; echo '<form method="post" id="tracks" action="manage_artists.php"><a href="manage_artists.php?add">Add New</a>'; ?> <a href="javascript:;" onclick="submitform()">Delete Selected</a> <?php include 'inc/m_artists_list.php'; echo '</form>'; ?> <script type="text/javascript"> function submitform() { document.getElementById('tracks').submit(); } </script>
  13. Ok peeps... This is my code: <div style="position:relative;top:60px;font-size:9px;">now in your cart: <?php if($_SESSION['customCartCount'] > 0){echo $_SESSION['customCartCount'];} else { echo "0"; } ?> items.</div> It returns the count of cart items stored in the session. The problem is it only gets updated once the page is reloaded. Is there any way I can update and display it periodically without having to reload the page?
  14. The problem is that I actually need to display the characters.
  15. Yes it's a black diamond with a question mark. Could you please explain a bit more what exactly your suggested script does.
  16. Greetings all I'm using Joomla with the Joomfish component for the translations and returning some of the translations using a custom php script. the site displays correctly but what I'm retreavingand displaying as weirdd question marks in it. I know it's to do with the charset but how can I alter the retrieved charset without actually altering anything in the database content or structure. I tried mysql_set_charset($link,utf8) but it seemed to alter and change the database. any suggestions?
  17. Found a sollution... http://www.phpfreaks.com/forums/index.php/topic,273048.msg1289586.html#msg1289586
  18. Does anyone know how i could convert the results of a mysql query into an iso-8859-1 character set?
  19. Hi boys andd girls im trying to get a invoice sorted. The checkout of the shopping cart and everything else works perfectly, but I hit a snag with the proforma invoice that gets sent to the client. all orders are stored in the database and then retrieved and calculated with a mysql query, now my question is to make it echo or return the combined value of all the orders related to a particular session. It's currently only giving me the last item in the carts total as the grand total. But then aswel if the grand total is under 1900 an additional 85 should be added. while($record = mysql_fetch_assoc($result)) { $extprice = number_format($record['price'] * $record['a'], 2); if($record['total']>1900){ $grand_total = 85; }else{ $grand_total = 0; } $grand_total += $record['total']; $order_data .= " <tr> <td align=\"center\" valign=\"center\">{$record['a']}</td> <td align=\"center\">{$record['id']}</td> <td align=\"center\">{$record['name']}</td> <td align=\"center\">{$record['price']}</td> </td><td align=\"center\">{$record['total']}</td> </tr>"; } //Format the grand total $grand_total = number_format($grand_total, 2);
  20. Unfortunately javascript isn't an option as it is a mobi site
  21. Hi Everyone Ive written that validates a couple of fields after form submission, but would like to check that the values off an input box are only numbers. does anyone know how?
  22. Try this if statement: if(isset($_POST) && $_POST['dropdown_name'] != "")
  23. Does anyone know how I can use jquery to post data from a form to another form in an iframe?
×
×
  • 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.