Jump to content

izlik

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

izlik's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey there. im a beginner at php and started trying to make a tag script, and i got told i almost got it to work. if you go to http://filefrog.net/new.php?&s=300 and press the tag "games" (has enouff pictures to show the problem) and then go to the bottom of the page and press "next" the codes switch pages but shows the same images on both pages, why? <? include "includes/inc.php"; require_once("header.php"); $template->set_filenames(array( 'body' => 'tags.html') ); ?> <?php $con = mysql_connect("localhost","asd","das") OR die('Could not connect: ' . mysql_error()); mysql_select_db("asd", $con); //This checks to see if there is a page number. If not, it will set it to page 1 if (!(isset($pagenum))) { $pagenum = 1; } //Edit $result to be your query $result = mysql_query(" SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%' ORDER BY views $max ") OR die(mysql_error()); $rows = mysql_num_rows($result); //This is the number of results displayed per page $page_rows = 30; //This tells us the page number of our last page $last = ceil($rows/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } while($row = mysql_fetch_array($result)) { echo '<div style="float:left;width:25%"><a href="http://filefrog.net/show.php/' .$row['id'].'_' .$row['name'].'"><img src="http://www.filefrog.net/out.php/t' .$row['id'].'_' .$row['name'].'"></a></div>'; echo "<br>\n"; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; ?> <div style="clear:both"></div> <? // This shows the user what page they are on, and the total number of pages echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&tag={$_GET['tag']}'> <-Previous</a> "; } //just a spacer echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&tag={$_GET['tag']}'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&tag={$_GET['tag']}'>Last ->></a> "; } ?> <? include "footer.php"; ?>
  2. thanks! i managed to get it to work so if you go to the page in my first post and press the tag and the next button in the bottom it loads page 2 now, BUT it shows the same images on both pages, why is this ?
  3. Hey there. im a beginner at php and started trying to make a tag script, and i got told i almost got it to work, i just need to make it so $pagenum and $tag wont register globals and i right now have no clue how to do that. i wonder if anyone could help me make it so $pagenum and $tag wont register globals in the code bellow? register_globals is turned of in my php.ini, and if you go to http://filefrog.net/new.php?&s=300 and press the tag "games" (has enouff pictures to show the problem) and then go to the bottom of the page and press "next" you can se the URL for the query. with this information, do you think you could help me to make it work? i would be eternely thankfull as im going crazy on that i cant fix it myself <?php $con = mysql_connect("localhost","asd","das") OR die('Could not connect: ' . mysql_error()); mysql_select_db("asd", $con); //This checks to see if there is a page number. If not, it will set it to page 1 if (!(isset($pagenum))) { $pagenum = 1; } $result = mysql_query(" SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%' ORDER BY views $max ") OR die(mysql_error()); $rows = mysql_num_rows($result); //This is the number of results displayed per page $page_rows = 30; $last = ceil($rows/$page_rows); if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; while($row = mysql_fetch_array($result)) { echo '<div style="float:left;width:25%"><a href="http://mydomain.net/show.php/' .$row['id'].'_' .$row['name'].'"><img src="http://www.mydomain.net/out.php/t' .$row['id'].'_' .$row['name'].'"></a></div>'; echo "<br>\n"; } ?> <div style="clear:both"></div> <? echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&tag={$_GET['tag']}'> <-Previous</a> "; } //just a spacer echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&tag={$_GET['tag']}'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&tag={$_GET['tag']}'>Last ->></a> "; } ?>
  4. hey there. register_globals is turned of in my php.ini and the code above is te only code i have, and if you go to http://filefrog.net/new.php?&s=300 and press the tag "games" (has enouff pictures to show the problem) and then go to the bottom of the page and press "next" you can se the URL with this information, do you think you could help me to make it work? i would be eternely thankfull as im going crazy on that i cant fix it myself!
  5. Hey there. im a beginner at php and started trying to make a tag script, and i got told i almost got it to work, i just need to make it so $pagenum and $tag wont register globals and i right now have no clue how to do that. i wonder if anyone could help me make it so $pagenum and $tag wont register globals in the code bwllow? <?php $con = mysql_connect("localhost","asd","das") OR die('Could not connect: ' . mysql_error()); mysql_select_db("asd", $con); //This checks to see if there is a page number. If not, it will set it to page 1 if (!(isset($pagenum))) { $pagenum = 1; } $result = mysql_query(" SELECT * FROM `images` WHERE `tags` LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%' ORDER BY views $max ") OR die(mysql_error()); $rows = mysql_num_rows($result); //This is the number of results displayed per page $page_rows = 30; $last = ceil($rows/$page_rows); if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; while($row = mysql_fetch_array($result)) { echo '<div style="float:left;width:25%"><a href="http://mydomain.net/show.php/' .$row['id'].'_' .$row['name'].'"><img src="http://www.mydomain.net/out.php/t' .$row['id'].'_' .$row['name'].'"></a></div>'; echo "<br>\n"; } ?> <div style="clear:both"></div> <? echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&tag={$_GET['tag']}'> <-Previous</a> "; } //just a spacer echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&tag={$_GET['tag']}'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&tag={$_GET['tag']}'>Last ->></a> "; } ?>
  6. anyone around still that think they could help out? :/ i would be very very much greatfull
  7. Hey again. i added in what you said into the code so it looks like bellow, but when i now press "next" it will reload the page on page 1 al lthe time and not go to 2 or 3 "/tags.php?pagenum=2&tag=" <-- resault i get in the browser, no tag :/ <? echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&tag={$_GET['tag']}'> <-Previous</a> "; } //just a spacer echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&tag={$_GET['tag']}'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&tag={$_GET['tag']}'>Last ->></a> "; } ?>
  8. hello, this code http://nopaste.php-quake.net/9687 it's a tag system and on the bottom of the page there is a "next" to shift page if there is more then 30 images in total for the tag a user pressed. if i however have the tag "tags.php?=games" and press "next" it becomes "tags.php?pagenum=2" and everyting becomes messed up, do anyone know why? and could help me some this problem? :/ i cant get my head around it.
  9. Hey there, after searching trou google i did not find what i need, so i wonder if anyone know where i can find an upload script "mostly for image upload use" that has multiple categorys to choose from when uploading.
  10. Hello, im using windows IIS 6.0 and im using the code shown bellow to to redirect users to diffrent areas of my webroot, but i wonder how i can make this work for virtual folders. if i use folding/myfolding.html on the include file i get my 404 page if i have the /folding/ as a virtual directory. so how could i make this work for a virtual directory? <% session.LCID=1053 %> <% Response.CacheControl = "no-cache" %> <% Response.AddHeader "Pragma", "no-cache" %> <% Response.Expires = -1 %> <% SiteNameURL = Request.ServerVariables("SERVER_NAME") If SiteNameURL = "www.page.se" Then %><!-- #Include File="index.php" --><% else If SiteNameURL = "folding.page.se" Then %><!-- #Include File="folding/myfolding.html" --><% else End If end if %>
  11. im having a problem with that part, each time i trye to ad it i break the code
  12. nothing on the filter, but the code bellow are for teh images. atm the message wont appear at all on "visabild.php" "when someone clicks and image it gets opened in "visabild.php" $res = mysql_query('SELECT *,unix_timestamp(tstamp) as utstamp FROM mms ORDER BY tstamp DESC LIMIT 6'); echo "<table cellspacing=\"3\" cellpadding=\"1\" border=\"2\"><tr>"; while ($row = mysql_fetch_assoc($res)) { echo "<td>"; $row['message'] = substr($row['message'],strpos($row['message'],' ')); if ( file_exists('data/' . $row['id'] . '.jpeg') ) { $row['picture'] = 'data/' . $row['id'] . '.jpeg'; } else $row['picture'] = ''; if ( $row['picture'] != '' ) { echo '<a href="'.$row['picture'].'"OnClick="window.open('."'".'visabild.php?id='.$row['id']."'".',null,'."'".'width=593,height=721'."'".'); return false;">'; echo '<img width="125" src="' . $row['picture'] . '"></a>'; } echo "</td>"; } echo "</tr></table>"; ?> Visabild.php <head><link href="/comments/style.css" rel="stylesheet" type="text/css" /></head> <?php error_reporting(E_ALL ^ E_NOTICE); ?> <center><img width="350" src="data/<?=$_GET['id']?>.jpeg"></center> <br> <?php echo $_GET["message"]; ?> <br> <?php include 'comments/comments.php';?>
  13. hello. i hope someone could help me with a little problem. i have a page where people can send in MMS pictures and they get uploaded and displayed on my page, they need to type a keyword in the MMS like "sendmms" to make it work. if they also write "sendmms hey look at me" it also works since "sendmms" was at the beginning of the message and "sendmms hey look at me" get's added to the row "message" in my database. the pictures get an ID in the database and saved with the same ID on the server. so under each picture sent in i wanted to add the comment they added after the "senmms" part. so in short, how do i make it filter out "sendmms" and only display "hey look at me" ? and if the Page ID is let's say 13 it should display the "messsage" column for the ID in the database that has the same ID as the page ID is. i hope someone can help me with this.
  14. Hey there If some person could help me with this i would be eternely thankfull. let's say i have this form that's shown bellow, and i when a user inserts their cell number in the field and presses the button, i want it to search trou the database named "mms" and the table "numbers" and search for their number on the row ['sender'] for the number enterd, then if a number is found search the row ['id'] use that it and check if a .jph file in /data/ folder has the same name as that id, and if it exist, display the picture or pictures on the page (if they sent in several) from that number with a link to each picture Edit: Basiclly, i have a page where where i send in my MMS message from my cellphone, when intercepted by my script it's enterd into the database on the Row "ID" and given and uniqe Id number, then the picture is save with that ID name into the folder /data/ and my cellnumber is enterd on the row "sender" in the same database. now what i want is a script form that i cant enter my cellnumber into, press "search" and it searcher the database for "my number" or number (if i sent in more then 1 times" and displays all the images that i have send in with link's to then example [Picture shown here] [Link to the picture shown under it] i hope this made more sense HTML: <form name="input" action="action.php" method="get"> Cell numbet: <input type="text" name="user"> <input type="submit" value="Search"> </form> I know how to make the PHP script get the cell number, but i have no idea at all how to make it search for the rest i wanted it to do
×
×
  • 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.