Jump to content

djfox

Members
  • Posts

    327
  • Joined

  • Last visited

    Never

Everything posted by djfox

  1. In a previous post, it was told to me to use time() for a function I`m working on. First, I`ll share the code: <?php $time= time(); if ($time=time()+3600) { $petfood= $rows[5] -2; mysql_query("UPDATE ownedpets SET food=$petfood WHERE id='$id'"); } ?> What this is supposed to do is subtract 2 from $rows[5] every hour. But instead what is happening is that 2 is subtracted from $rows[5] every time the page loads. Changing the time (right now it`s 3600) doesn`t affect it at all. Am I doing something wrong?
  2. If I want to recall and manipulate information in the databases that are in two (or more) different databases, how can this be done? I can do this with one single database no problem, but am having trouble figuring out the multiple database thing.
  3. I`m not sure how familiar you guys are with these online pets. But I`ve seen ones where like, every hour, their food points go down by like two or however amount the site sets (to encourage the pets` owners to feed the pet). Are they using php for that or something else?
  4. I have this following code: <?php // File and new size //$imgfile = 'thumb.jpg'; //$percent = 0.2; header('Content-type: image/jpeg'); $imgfile = $_GET['img']; list($width, $height) = getimagesize($imgfile); //echo $width, $height; $newwidth = 100; $factor = $newwidth / $width; //echo $factor; $newheight = $height * $factor; $thumb = ImageCreateTrueColor($newwidth,$newheight); $source = imagecreatefromjpeg($imgfile); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb); ?> It has the width set to 100 pixels. How can I add in for this code to set the height to 100? I don`t want it coming out 100x100 pixels. What I`m looking for is for this to set the image pixels as maximum 100 pixels wide and maximum 100 pixels high. So if the image is shorter in either field, the thumbnail wil adjust accordingly.
  5. I have the following codes: <?php $total = $rows[8] + $rows[9] + $rows[10] + $rows[11] + $rows[12] ; $per1 = $rows[8]/$total ; $per2 = $rows[9]/$total ; $per3 = $rows[10]/$total ; $per4 = $rows[11]/$total ; $per5 = $rows[12]/$total ; if (isset($_GET['results']) && $_GET['results'] == "view") { echo "<b>Results:</b>"; echo "<br>$rows[3] <b>$rows[8]</b><br><font size=2>$per1 %</font>"; echo "<br>$rows[4] <b>$rows[9]</b><br><font size=2>$per2 %</font>"; echo "<br>$rows[5] <b>$rows[10]</b><br><font size=2>$per3 %</font>"; echo "<br>$rows[6] <b>$rows[11]</b><br><font size=2>$per4 %</font>"; echo "<br>$rows[7] <b>$rows[12]</b><br><font size=2>$per5 %</font>"; echo "<p>$total Votes"; } ?> How can I convert the $per values to display as percentages? Currently they display as 0.5 and so on.
  6. Well, I certainly didn`t expect any split second answers. As for the $add being executed, it is executed: if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { $res = mysql_query($add) or die(mysql_error()); header("Location: index.php"); }
  7. There are no errors. It`s not working by it is not loading the file and it is not inserting the information into the database.
  8. I have a set of codes to upload an image file to my server. This one set of codes for the art gallery works. I copied these codes to use for uploading image files for a store`s website. The ONLY difference between them is the displayed design of the pages and their redirecting links and the store`s files are under a subfolder. Why doesn`t the store`s codes work? The Art Gallery Codes submit.php <?php //Date: February 24 2007 //For: www.secrettrance.net //Description: Upload New Trance include("dbcon.php"); require_once "design.php"; require_once "auth.php"; require_once "includes/defines.php"; $Title = "Secret Trance: Upload New Trance"; require_once "header.php"; require_once "hidestatus.php"; if (!isLoggedIn()) { Redirect("index.php"); } ?> <table border=0 width=100%><? //2 ?> <tr> <td> <table border=0 width=100% bgcolor="000000"><? //3 ?> <tr> <td background="<? echo $boxbanner; ?>"><b>Upload New Trance</b> <tr> <td background="<? echo $boxback; ?>"> <?php if( $suspend < 1){ ?> <form enctype="multipart/form-data" action="upload.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="3000000" /> <b>Image File:</b> <a href="javascript:void(0)" ONCLICK="open('help1.php','miniwin','toolbar=0, location=0,directories=0, status=0,menubar=0, scrollbars=0,resizable=0, width=300,height=300')">?</a> <br><input name="userfile" style="font-size: 13px; background-color: #000000; border: 0px;" type="file" /> <input type=hidden name="l" value="<? echo rtrim($log) ?>"> <p> <b>Title:</b> <a href="javascript:void(0)" ONCLICK="open('help2.php','miniwin','toolbar=0, location=0,directories=0, status=0,menubar=0, scrollbars=0,resizable=0, width=300,height=300')">?</a> <br><input type=text name="n" size=50 maxlength=150> <p> <b>Description:</b> <a href="javascript:void(0)" ONCLICK="open('help3.php','miniwin','toolbar=0, location=0,directories=0, status=0,menubar=0, scrollbars=0,resizable=0, width=300,height=300')">?</a> <br><textarea name="t" cols=80 rows=5 style="border: 0px; background-color:#000000; color: #B6ABCE;"></textarea> <p> <b>Select a Category:</b> <a href="javascript:void(0)" ONCLICK="open('help4.php','miniwin','toolbar=0, location=0,directories=0, status=0,menubar=0, scrollbars=0,resizable=0, width=300,height=300')">?</a> <br><select name="cat" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <? $res = mysql_query("SELECT id, name FROM imagecats ORDER BY name ASC"); while ( $cat = mysql_fetch_row($res) ){ echo "<option value='$cat[0]'>$cat[1]</option>"; } ?> </select> <p> <b>Literature:</b> <a href="javascript:void(0)" ONCLICK="open('help5.php','miniwin','toolbar=0, location=0,directories=0, status=0,menubar=0, scrollbars=0,resizable=0, width=300,height=300')">?</a> <br><textarea name="s" cols=80 rows=5 style="border: 0px; background-color:#000000; color: #B6ABCE;"></textarea> <p> <b>Keywords:</b> <br><input type=text name="key" size=50 maxlength=255> <p> <input type="submit" value="Upload Trance" /></form> <?php } else { if( $suspend > 0){ echo "Sorry, your account is on suspension. You must wait until suspension expires before you can access this."; } } ?> </table><? //3 ?> </table><? //2 ?> <p> <? require_once "footer.php"; ?> upload.php <?php session_start(); include("dbcon.php"); include("auth.php"); //Date: February 25 2007 //For: secrettrance.net //Description: Upload a new trance $log=$l; //Get the users upload limits $res=mysql_query("SELECT dLim, mLim, gLim, isHold, id FROM userdata WHERE login='$log'"); $rows = mysql_fetch_row($res); $dailyLim=$rows[0]; $monthlyLim=$rows[1]; $galleryLim=$rows[2]; $hold=$rows[3]; $gall = $rows[4]; mysql_free_result($res); //Decide where the file is going if ( $temp ){ $uploaddir = 'gallery/$lname/'; }else{ $uploaddir = "gallery/$log/"; } $file=$_FILES['userfile']['name']; $uploadfile = $uploaddir . $file; $uploadthumb = "thumbs/" . $file; //The add query $entry_date = strftime("%B\ %e\,\ %Y %H:%M:%S", time()); $add="INSERT INTO image ( name, description, gallNum, URL, thumbURL, rating, numRates, addDate, cat, literature, keyw ) VALUES ( '$n', '$t', $gall, '$uploadfile', '$uploadthumb', 0, 0, '$entry_date', $cat, '$s', '$key' )"; //The users current upload usage on the system $daily="SELECT COUNT(*) from image WHERE addDate=NOW() AND gallNum=$gall"; $res=mysql_query($daily); $temp = mysql_fetch_row($res); $d = $temp[0]; mysql_free_result($res); $monthly="SELECT COUNT(*) from image WHERE MONTH(addDate)=MONTH(NOW()) AND YEAR(addDate)=YEAR(NOW()) AND gallNum=$gall"; $res=mysql_query($monthly); $temp = mysql_fetch_row($res); $m = $temp[0]; mysql_free_result($res); $gallery="SELECT COUNT(*) from image WHERE gallNum=$gall"; $res=mysql_query($gallery); $temp = mysql_fetch_row($res); $g = $temp[0]; mysql_free_result($res); $exten=split('\.',$file); //Check for file restrictions if($exten[1]=="jpg"||$exten[1]=="jpeg"||$exten[1]=="gif"||$exten[1]=="JPG"||$exten[1]=="JPEG"||$exten[1]=="GIF"||$exten[1]=="png"||$exten[1]=="PNG"){ //Check for suspension if(!$hold){ //Check for usage limit hit if($dailyLim>$d && $monthlyLim>$m && $galleryLim > $g){ // The actual uploading if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { $res = mysql_query($add) or die(mysql_error()); header("Location: trancer.php"); } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } }else{ echo "You can`t exceed your upload limit. View <a href='manual.php'>the manual</a> for more information."; } }else{ echo "You're on suspension. Please talk to an administrator."; } }else{ echo "Invalid file extension. Please only upload .jpg, .png or .gif files. Thank You."; } mysql_close($con); //redirect header("Location: uploadechos.php"); //-----upload.php ?> uploadechos.php <?php include("dbcon.php"); include("func.php"); require_once "auth.php"; require_once "includes/defines.php"; $log = $_SESSION['sess_name']; $_SESSION['echos'] = $echos = $echos + 10; mysql_query("UPDATE userdata SET echo_count = $echos WHERE login = '".$log."' ") or die(mysql_error()); header("Location: trancer.php"); ?> auth.php <?php //====================================================== // Auth routines // (c) 2006 Joao Pinheiro //====================================================== // Defines DEFINE('SESSION_MAGIC','sadhjasklsad2342'); // Initialization @session_start(); @ob_start(); /* Redirects to another page */ function Redirect($to) { @session_write_close(); @ob_end_clean(); @header("Location: $to"); } /* Deletes existing session */ function RemoveSession() { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { @setcookie(session_name(), '', time()-42000, '/'); } } /* Checks if user is logged in */ function isLoggedIn() { return(isset($_SESSION['magic']) && ($_SESSION['magic']==SESSION_MAGIC)); } /* Terminates an existing session */ function Logout() { @RemoveSession(); @session_destroy(); } /* read message count */ function CountMessages($id) { if ($res=mysql_query("SELECT * FROM messagedata WHERE recBoxID=$id AND isNew=1")) { $count=mysql_num_rows($res); mysql_free_result($res); return($count); } return 0; } /* Go login go! */ function Login($username,$password) { global $nmsg, $rows; $ok=false; if ($res=mysql_query("SELECT id,level,mailNum, echo_count, status, isHold, guildLim, adult FROM userdata WHERE login='$username' AND password='$password'")) { if ($rows=mysql_fetch_row($res)) { $_SESSION['sess_name'] = $username; $_SESSION['pass'] = $password; $_SESSION['gal'] = $rows[0]; $_SESSION['mail'] = $rows[2]; $_SESSION['level2'] = $rows[1]; $_SESSION['echos'] = $rows[3]; $_SESSION['status'] = $rows[4]; $_SESSION['suspend'] = $rows[5]; $_SESSION['guildnum'] = $rows[6]; $_SESSION['adult'] = $rows[7]; $_SESSION['magic'] = SESSION_MAGIC; $_SESSION['rows'] = $rows; /* stupid stupid hack */ $nmsg = CountMessages($rows[0]); $ok=true; } else { include('login_failed.php'); } mysql_free_result($res); } return($ok); } /* Escape array using mysql */ function Escape(&$arr) { if (Count($arr)>0) { foreach($arr as $k => $v) { if (is_array($v)) { Escape($arr[$k]); } else { if (function_exists('get_magic_quotes')) { if(!get_magic_quotes_gpc()) { $arr[$k] = stripslashes($v); } } $arr[$k] = mysql_real_escape_string($v); } } } } // ----------------------------------------------- // Main // ----------------------------------------------- Escape($_POST); Escape($_GET); Escape($_COOKIE); Escape($_REQUEST); Escape($_GLOBALS); Escape($_SERVER); ?> The Store`s Files product_add.php <?php //Date: August 26 2007 //For: A Place for Pets //Description: Add a Product include("dbcon.php"); require_once "auth.php"; require_once "includes/defines.php"; $Title = "A Place for Pets: Admin Panel: Add a Product"; require_once "header.php"; require_once "hidestatus.php"; if (!isLoggedIn()) { Redirect("index.php"); } $lev=$_SESSION['level2']; $log=$_SESSION['gal']; ?> <table width=100% border=0 cellpadding=0><? //1 ?> <tr> <td width=20% valign=top> <? require_once "navbar.php"; ?> <td> <td> <td> <td width=80% valign=top> <?php if( $lev > { ?> <table border=0 width=100% bgcolor="<? echo $outline; ?>"><? //2 ?> <tr> <td bgcolor="<? echo $head; ?>"><font color="<? echo $font1; ?>"><b>Admin Panel: Add a Product</b></font> </table> <? //2 ?> <?php if( $suspend < 1){ ?> <form enctype="multipart/form-data" action="upload.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="3000000" /> <b>Image File:</b> <br><input name="userfile" style="font-size: 13px; background-color: #000000; border: 0px;" type="file" /> <input type=hidden name="l" value="<? echo rtrim($log) ?>"> <p> <b>Title:</b> <br><input type=text name="n" size=50 maxlength=150> <p> <b>Description:</b> <br><textarea name="t" cols=80 rows=5 style="border: 0px; background-color:#000000; color: #B6ABCE;"></textarea> <p> <b>Select a Category:</b> <br><select name="cat" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <? $res = mysql_query("SELECT id, name FROM imagecats ORDER BY name ASC"); while ( $cat = mysql_fetch_row($res) ){ echo "<option value='$cat[0]'>$cat[1]</option>"; } ?> </select> <p> <b>Literature:</b> <br><textarea name="s" cols=80 rows=5 style="border: 0px; background-color:#000000; color: #B6ABCE;"></textarea> <p> <b>Keywords:</b> <br><input type=text name="key" size=50 maxlength=255> <p> <input type="submit" value="Upload Trance" /></form> <?php } else { if( $suspend > 0){ echo "Sorry, your account is on suspension. You must wait until suspension expires before you can access this."; } } ?> <? } ?> </table><? //1 ?> <? require_once "footer.php"; ?> upload.php <?php session_start(); include("dbcon.php"); include("auth.php"); //Date: August 26 2007 //For: A Place for Pets //Description: Upload a new trance $log=$l; //Get the users upload limits $res=mysql_query("SELECT dLim, mLim, gLim, isHold, id FROM userdata WHERE login='$log'"); $rows = mysql_fetch_row($res); $dailyLim=$rows[0]; $monthlyLim=$rows[1]; $galleryLim=$rows[2]; $hold=$rows[3]; $gall = $rows[4]; mysql_free_result($res); //Decide where the file is going if ( $temp ){ $uploaddir = 'gallery/$lname/'; }else{ $uploaddir = "gallery/$log/"; } $file=$_FILES['userfile']['name']; $uploadfile = $uploaddir . $file; $uploadthumb = "thumbs/" . $file; //The add query $entry_date = strftime("%B\ %e\,\ %Y %H:%M:%S", time()); $add="INSERT INTO image ( name, description, gallNum, URL, thumbURL, rating, numRates, addDate, cat, literature, keyw ) VALUES ( '$n', '$t', $gall, '$uploadfile', '$uploadthumb', 0, 0, '$entry_date', $cat, '$s', '$key' )"; //The users current upload usage on the system $daily="SELECT COUNT(*) from image WHERE addDate=NOW() AND gallNum=$gall"; $res=mysql_query($daily); $temp = mysql_fetch_row($res); $d = $temp[0]; mysql_free_result($res); $monthly="SELECT COUNT(*) from image WHERE MONTH(addDate)=MONTH(NOW()) AND YEAR(addDate)=YEAR(NOW()) AND gallNum=$gall"; $res=mysql_query($monthly); $temp = mysql_fetch_row($res); $m = $temp[0]; mysql_free_result($res); $gallery="SELECT COUNT(*) from image WHERE gallNum=$gall"; $res=mysql_query($gallery); $temp = mysql_fetch_row($res); $g = $temp[0]; mysql_free_result($res); $exten=split('\.',$file); //Check for file restrictions if($exten[1]=="jpg"||$exten[1]=="jpeg"||$exten[1]=="gif"||$exten[1]=="JPG"||$exten[1]=="JPEG"||$exten[1]=="GIF"||$exten[1]=="png"||$exten[1]=="PNG"){ //Check for suspension if(!$hold){ //Check for usage limit hit if($dailyLim>$d && $monthlyLim>$m && $galleryLim > $g){ // The actual uploading if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { $res = mysql_query($add) or die(mysql_error()); header("Location: index.php"); } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } }else{ echo "You can`t exceed your upload limit."; } }else{ echo "You're on suspension. Please talk to an administrator."; } }else{ echo "Invalid file extension. Please only upload .jpg, .png or .gif files."; } mysql_close($con); //redirect header("Location: product_add.php"); ?> auth.php <?php //====================================================== // Auth routines // (c) 2006 Joao Pinheiro //====================================================== // Defines DEFINE('SESSION_MAGIC','sadhjasklsad2342'); // Initialization @session_start(); @ob_start(); /* Redirects to another page */ function Redirect($to) { @session_write_close(); @ob_end_clean(); @header("Location: $to"); } /* Deletes existing session */ function RemoveSession() { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { @setcookie(session_name(), '', time()-42000, '/'); } } /* Checks if user is logged in */ function isLoggedIn() { return(isset($_SESSION['magic']) && ($_SESSION['magic']==SESSION_MAGIC)); } /* Terminates an existing session */ function Logout() { @RemoveSession(); @session_destroy(); } /* read message count */ function CountMessages($id) { if ($res=mysql_query("SELECT * FROM messagedata WHERE recBoxID=$id AND isNew=1")) { $count=mysql_num_rows($res); mysql_free_result($res); return($count); } return 0; } /* Go login go! */ function Login($username,$password) { global $nmsg, $rows; $ok=false; if ($res=mysql_query("SELECT id,level,mailNum, echo_count, isHold FROM userdata WHERE login='$username' AND password='$password'")) { if ($rows=mysql_fetch_row($res)) { $_SESSION['sess_name'] = $username; $_SESSION['pass'] = $password; $_SESSION['gal'] = $rows[0]; $_SESSION['mail'] = $rows[2]; $_SESSION['level2'] = $rows[1]; $_SESSION['echos'] = $rows[3]; $_SESSION['suspend'] = $rows[4]; $_SESSION['magic'] = SESSION_MAGIC; $_SESSION['rows'] = $rows; /* stupid stupid hack */ $nmsg = CountMessages($rows[0]); $ok=true; } else { include('login_failed.php'); } mysql_free_result($res); } return($ok); } /* Escape array using mysql */ function Escape(&$arr) { if (Count($arr)>0) { foreach($arr as $k => $v) { if (is_array($v)) { Escape($arr[$k]); } else { if (function_exists('get_magic_quotes')) { if(!get_magic_quotes_gpc()) { $arr[$k] = stripslashes($v); } } $arr[$k] = mysql_real_escape_string($v); } } } } // ----------------------------------------------- // Main // ----------------------------------------------- Escape($_POST); Escape($_GET); Escape($_COOKIE); Escape($_REQUEST); Escape($_GLOBALS); Escape($_SERVER); ?> I just don`t get it. I`ve been trying many different ways to get the store to upload files to the server and add the information into the database. The databases of the art gallery and the store both have mirrored userdata and mirrored image and mirrored catimages tables. I`ve been fighting this for a couple weeks now.
  9. I removed this from settings.php: $res = mysql_query("SELECT adult FROM userdata WHERE id='$id'"); $rows = mysql_fetch_row($res); mysql_free_result($res); but that didn`t make any difference.
  10. settings.php <?php //Date: September 13 2007 //For: secrettrance.net //Description: Manage Profile: Update Settings session_start(); include("dbcon.php"); include("func.php"); require_once "design.php"; require_once "auth.php"; require_once "includes/defines.php"; $id = $_SESSION['gal']; $lev=$_SESSION['level2']; $Title = "Secret Trance: Manage Profile: Update Settings"; require_once "header.php"; require_once "hidestatus.php"; if (!isLoggedIn()) { Redirect("index.php"); } ?> <table border=0 width=100%><? //1 ?> <tr> <td> <table border=0 width=100% bgcolor="000000"><? //2 ?> <tr> <td background="<? echo "$boxbanner"; ?>"><b>Manage Profile: Update Settings</b> <tr> <td background="<? echo "$boxback"; ?>"> <?php if( $lev > 0){ if( $suspend < 1){ $res = mysql_query("SELECT adult FROM userdata WHERE id='$id'"); $rows = mysql_fetch_row($res); mysql_free_result($res); ?> <blockquote> <font size=2><i>Change settings at your own risk. Secret Trance is not held respnsible for anything that could happen when any part of the settings are altered. By setting adult rating to "Adult/Mature", you are verifying that you are at least 18 years of age to view such content.</i></font> </blockquote> <form action="settings2.php"> <b>Adult Rating:</b> <br><select name="adult" style="border: 0px; background-color:#000000; color: #B6ABCE;"> <option value="0">Up to PG-13</option> <option value="1">Adult/Mature Content</option> </select> <p> <? echo "<input type='hidden' name='id' value='$id'>"; echo "<input type='submit' name='submit' value='Update Settings'>"; ?> </form> <?php } else { if( $suspend > 0){ echo "Sorry, your account is on suspension. You must wait until suspension expires before you can access this."; } } } ?> </table><? //2 ?> </table><? //1 ?> <p> <? require("footer.php"); ?> settings2.php <?php session_start(); include("dbcon.php"); include("auth.php"); //Date: September 13 2007 //For: secrettrance.net //Description: Update Settings if (!isLoggedIn()) { Redirect("index.php"); } $id = $_SESSION['gal']; mysql_query("UPDATE userdata SET adult='$adult' WHERE id=$id"); mysql_close($con); //redirect header("Location: manageprofile.php"); ?> It`s more or less the same codes I used to update other fields in databases but for some reason this one will not work. It will not update the adult field. It keeps leaving it at 1.
  11. There are no errors. And yes you are right, it is not working as in it is showing the adult images regardless of the preference. Echoing $adult brings back 1. Doing a few runs I`m seeing that the code I set to change the adult rating preference for some reason is not entering the correct information when saving (which I`m not sure why, it`s the same codes I`ve been using through the site). So looks like I have to get that to work first. Thanks for looking into and pulling out a suggestion that led me to see there was a problem elsewhere.
  12. Yes, those values are defined previously. I just didn`t feel the need to post those parts here since they aren`t the problem.
  13. <?php $adult = $_SESSION['adult']; if( $adult > 0){ $cat=isset($_REQUEST['cat'])?$_REQUEST['cat']:-1; if(!$offset) $offset=0; $recent = 0; $res = mysql_query("Select id,url,addDate FROM image WHERE cat=$cat ORDER BY id DESC")or die( mysql_error() ); echo "<table width='100%'>"; while( $row = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 25 )){ if( $recent%5 == 0 ){ echo "<tr><td><tr><td><tr><td><tr><td><tr>"; } echo "<td align=center><a href='trances.php?id=$row[0]'><img src='thumbnail.php?img=$row[1]' border=0></a>"; } $recent = $recent + 1; } echo "</table>"; } else { if( $adult < 1){ $cat=isset($_REQUEST['cat'])?$_REQUEST['cat']:-1; if(!$offset) $offset=0; $recent = 0; $res = mysql_query("Select id,url,addDate FROM image WHERE cat=$cat, adult=0 ORDER BY id DESC")or die( mysql_error() ); echo "<table width='100%'>"; while( $row = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 25 )){ if( $recent%5 == 0 ){ echo "<tr><td><tr><td><tr><td><tr><td><tr>"; } echo "<td align=center><a href='trances.php?id=$row[0]'><img src='thumbnail.php?img=$row[1]' border=0></a>"; } $recent = $recent + 1; } echo "</table>"; } } ?> Ok, did that.
  14. I`m adding in an adult rating to images so people who say they don`t want to see images with adult content won`t see them. But it doesn`t seem to be working. Can someone check me over: <?php $adult = $_SESSION['adult']; if( $adult > 0){ ?> <? $cat=isset($_REQUEST['cat'])?$_REQUEST['cat']:-1; if(!$offset) $offset=0; $recent = 0; $res = mysql_query("Select id,url,addDate FROM image WHERE cat=$cat ORDER BY id DESC")or die( mysql_error() ); echo "<table width='100%'>"; while( $row = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 25 )){ if( $recent%5 == 0 ){ echo "<tr><td><tr><td><tr><td><tr><td><tr>"; } echo "<td align=center><a href='trances.php?id=$row[0]'><img src='thumbnail.php?img=$row[1]' border=0></a>"; } $recent = $recent + 1; } echo "</table>"; ?> <?php } else { if( $adult < 1){ ?> <? $cat=isset($_REQUEST['cat'])?$_REQUEST['cat']:-1; if(!$offset) $offset=0; $recent = 0; $res = mysql_query("Select id,url,addDate FROM image WHERE cat=$cat, adult=0 ORDER BY id DESC")or die( mysql_error() ); echo "<table width='100%'>"; while( $row = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 25 )){ if( $recent%5 == 0 ){ echo "<tr><td><tr><td><tr><td><tr><td><tr>"; } echo "<td align=center><a href='trances.php?id=$row[0]'><img src='thumbnail.php?img=$row[1]' border=0></a>"; } $recent = $recent + 1; } echo "</table>"; ?> <?php } } ?>
  15. Ah ok, excellent! One last question, is there anyway to modify this? Like if I want this to display the information in kilobytes or megabytes?
  16. Can smeone double check my code on this: <?php $filename = '$rows[3]'; echo filesize($filename) . ' bytes'; ?> I get an error and am not sure if I messed the code up somewhere.
  17. I`ve been toying around with the function getimagesize() and looking over other sites and http://www.php.net/getimagesize and got the width and height in pixels, and finally managed to get the file type (jpg, png, gif, etc). But how do I get the actual file size? (Ie, the part that says ###KB or ###MB)
  18. If I have an image being used in an art gallery fashion, is it going to be php I use to to display with the dimensions and file size of the image that is being loaded in? Or am I going to be using a different kind of code to pull that information?
×
×
  • 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.