Jump to content

gfX

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by gfX

  1. OK I am getting close! After reading on Stackoverflow here is what I have now: http://www.autoshopgarage.com/new-era/test2.php?text=testing+%3Cb%3Escript%3C/b%3E%20this%20is%20so%20cool%20i%20love%20it That does what I want, the only problem with this is now I can't get the wordwrap to work! It should wrap to the next line, but I cannot seem to get it. Here is the new PHP code: <?php header('Content-type: image/png'); $im = imagecreatefrompng ( "banner_blank.png" ); $color = imagecolorallocate($image, 0, 0, 0); $tmp = $_GET['text']; $words = explode(" ", $tmp); $x = array(0,0,230); // DUMMY ARRAY WITH X POSITION FOR FIRST WORD $addSpace = 0; foreach($words as $word) { if($addSpace) $word = " ".$word; // IF WORD IS NOT THE FIRST ONE, THEN ADD SPACE if(stristr($word, "<b>")) { $font = 'HelveticaNeueLTStd-BdEx.ttf'; // BOLD FONT $replace = str_replace(array("<b>","</b>"), "", $word); $x = imagettftext($im, 20, 0, $x[2], 20, $color, $font, $replace); } else { $font = 'HelveticaNeueLTStd-LtEx.ttf'; // NORMAL FONT $x = imagettftext($im, 20, 0, $x[2], 20, $color, $font, $word); } $addSpace = 1; } imagepng($im); imagedestroy($im); ?> Anyone have any ideas? Thanks!
  2. Hi guys, Here is what I have so far: http://www.autoshopgarage.com/new-era/generate.php What I am trying to do is instead of having Line 1 and Line 2, I want to just have one big textarea so I don't have to limit the user so much. I did it this way because I want to have two versions of text, the light version and the bold version. Is it possible to have two different fonts with just one textarea of text? Right now I have two functions: So I would limit that to just 1, and it would automatically wordwrap but what would I put for the $font variable? Is this even possible? I was thinking of just using BBCode so they could type in [b*]Bold Text[/b*] and it would use the Bold version of the font if it sees that. Any help is appreciated. Thanks! Here is the full code:
  3. Soooooo.. <table border="0" cellspacing="0" cellpadding="1" align="center"> <tr> <?php $sql = mysql_query("SELECT * FROM `layouts` ORDER BY `id` ASC"); $i = 0; while ($r=mysql_fetch_assoc($sql)) { $i++; $id = $r['id']; $title = $r['title']; $code = $r['code']; $thumbnail = $r['thumbnail']; if ($i > 0 && $i % 5 == 0) { print "</tr><tr>"; } echo "<td width='25%' align='center' valign='top'> <a href='http://www.layoutslife.com/code.php?id=$id'> <img src='http://www.layoutslife.com/thumbnails/$thumbnail' border='0' width='160' height='120' /></a> <br /><b>$title</b><br /></td>"; } ?> </tr> </table> ?? Almost there, Preview at: www.layoutslife.com
  4. Hello. What I am trying to do, is have 12 total layouts showing. 3 rows of 4. I am using tables for this, and it is generated using PHP. <table border="0" cellspacing="0" cellpadding="1" align="center"> <?php $sql = mysql_query("SELECT * FROM `layouts` ORDER BY `id` ASC"); $i = 0; while ($r=mysql_fetch_assoc($sql)) { $i++; $id = $r['id']; $title = $r['title']; $code = $r['code']; $thumbnail = $r['thumbnail']; if (($i == 5)) { echo "<tr>"; } echo "<td width='25%' align='center' valign='top'> <a href='http://www.layoutslife.com/code.php?id=$id'> <img src='http://www.layoutslife.com/thumbnails/$thumbnail' border='0' width='160' height='120' /></a> <br /><b>$title</b><br /></td>"; if (($i == 5)) { echo "</tr>"; } } ?> </table> That's the code I have, which I know is definitely wrong because it isn't working! Does anyone know how I can get this done? Here is a screenshot of how it displays with my current code: Thanks
  5. gfX

    Gallery Help

    Ah Thanks, that worked. Yeah that's from images being deleted from the database :( I wish that could be fixed, but other than that I really appreciate it! Thakns so much
  6. gfX

    Gallery Help

    Great man, fixed that one.  Now the only problem is that there is no next link.  It just shows the text. Any reason for that?
  7. gfX

    Gallery Help

    Hey there, Thakns for taking the time to supply that code! I get: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /hsphere/local/home2/andres30/vivagaete.com/viewgallery.php on line 21 Line 21: $total_rows = mysql_num_rows($sql); // find out how many rows are in that table, see what the max number is http://www.vivagaete.com/viewgallery.php?id=5
  8. gfX

    Gallery Help

    Thanks for the replies! That did work, but like KingPhilip said, I need it to check if it is in the database to get the right ID's. How would I make that if statement? Thanks a lot for the help.
  9. Hey guys, I have a gallery for a website: http://www.vivagaete.com/gallery.php If you click on the thumbnail it will bring up viewgallery.php - which has the larger image on it. What I want, is for viewgallery.php to have the options for "PREVIOUS and NEXT" images.  So they don't have to click "Click here to Go Back" every time, they can browse by clicking the NEXT link or PREVIOUS. How would I go about doing this to pull the next image ID from the database? Here is the code for viewgallery.php: [code] <style type="text/css"> .greentext { color: #2a8f3d; margin: 4px; font-family: Tahoma; font-size: 19px; } .blacktext { color: #000000; margin: 4px; font-family: Tahoma; font-size: 11px; } </style> <? include 'db.php'; $getid = $_GET['id']; $sql = "SELECT * FROM gallery WHERE id = $getid"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $picture = $row['picture']; $heading = $row['heading']; $description = $row['description']; } $sql2 = "SELECT id FROM gallery WHERE id > $id LIMIT 1"; $result2 = mysql_query($sql2); while ($row = mysql_fetch_array($result)) { $id = $row['id']; } if ($getid == "$id") { echo "<center> <FORM> $id <INPUT type='button' value='Click here to go back' onClick='history.back()'> </FORM> <div class=\"greentext\"><b>$heading</b></div> <div class=\"blacktext\">$description</div><br /> <img src=\"images/$picture\" style=\"border: 2px solid #d4cccc;\"><br /><br /> <FORM> <INPUT type='button' value='Click here to go back' onClick='history.back()'> </FORM></center>"; } else { echo "No image verfied"; } ?> [/code] Thanks a lot!!
  10. Thank you very much! This is random but how do you remove a file from FTP using PHP?
  11. I don't get what that has to do with it.
  12. Didn't work man, There were a few errors which I fixed up but that code isn't working :(
  13. Okay, So I have a photogallery with pagination.  And I set the limit to 3 photos per page.  And it has pagination for different pages. So, Say I have 7 Images in the database.  I SHOULD have 3 pages, and the third page should only have one image.  Well, My problem is:  If I had 7 images, It would only make 2 pages, and not make that third page, until I reached the limit (3 images). Here is the code: [code] <? include 'header.php';   include 'db.php'; ?> <div class="greentext">Select the photo you would like to view:<br /><br /> <?                  $num = $_GET['num']; if(empty($num)){ $num = 1; }; $limit = 3; $start = ($num-1)*$limit; $start = round($start,0); $sql = "SELECT * FROM `gallery` ORDER by `id` LIMIT $start, $limit"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { echo " <a href='viewgallery.php?id=$row[id]'><img src='galleryimages/$row[picture]' width='222' height='167' style='border: 2px solid #d4cccc;'>&nbsp;&nbsp;&nbsp;&nbsp;</a>"; } ?> <br /><br /> <? $totalpages = mysql_num_rows(mysql_query("SELECT * from `gallery`")); $totalpages = $totalpages / $limit; $totalpages = round($totalpages,0); $c = 0; while($c<$totalpages){ $page = $c + 1; if($_GET['num']==$page){ echo "&nbsp;&nbsp;[$page]"; }else{ echo "&nbsp;&nbsp;<a href=?num=$page>[$page]</a>"; } $c = $c+1; } echo "<br>".$totalpages." Pages in total.";     ?> </div> <? include 'footer.php'; ?> [/code] Thanks!
  14. Alright, I understand. So can you give me the correct code for this script to work? I tryed and it still did the same thing for me. Weird Thankss.
  15. Well if they didn't put a password - it would still be the old one. Because this is for admins, and what if they just want to update the users e-mail address. And even if I edit that stuff, The page still messes up. It says "UPDATED" just when I go to that page and clears that record in the database with blanks.
  16. I have an image hosting script here - and this is in the admin.php file. It will list all the registered users and then I click "Edit Details" and here is the script for that: [code] <fieldset class="fi">     <legend>Basic Details</legend>         <?php             if($_POST['basic']) {                 if($_POST['password'] !== "")                     $pass = md5($_POST['password']);                 }else{                     $pass = $_POST['password'];                 @mysql_query("UPDATE users SET nickname='$_POST[nickname]', password='$pass', email='$_POST[email]' WHERE nickname='$_GET[user]'");                 echo "<h2>Updated</h2>";             }         ?>         <form name="basic" action="admin.php?request=users&user=<?=$var['nickname']; ?>&act=do" method="post">         <b>Username</b>: <input class="text" name="nickname" size="40" value="<?=$var['nickname']; ?>"><br />         <b>Edit Password</b>: <input class="text" name="password" size="40" value=""><br />         <b>Email</b>: <input class="text" name="email" size="40" value="<?=$var['email']; ?>">         <input type="submit" name="basic">         </form> </fieldset>     [/code] But that script keeps messing up. When I click Edit details - It goes to that page but it already has the heading "Updated" and the values are there - and then when I click submit it updates the record in the database to nothing. Blank. So when I go to edit the user, it wont let me because all the values and username are "" and I have to keep restoring in the database. So I don't get to edit anything, whenever I click Edit Details for the user - it updates just when I go to the page and it won't let me update. Anyone see anything wrong with teh code? Thanks
  17. gfX

    Need help

    Yeah it works fine with teh AND username != '$username' Though the mysql_num_rows will not work, therefor it will not count succesfully and it won't show if the e-mail is already in use. And when I take out "AND username != '$username' then the mysql_num_rows error goes away though, but you can use someone elses email. It's really weird.
  18. gfX

    Need help

    Thank you! That seems to work. ALTHOUGH. Now that I changed the $sql a bit .. my mysql_num_rows will not work and it gives me an error. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/ddgfxco/public_html/imagenerd/options.php on line 11 but if I take out the AND username != '$user'"; - it doesn't give me an error. Although I need AND username != '$user'"; for it to work. Anyone know whats up?
  19. gfX

    Need help

    So is there a way to search teh database to check if the e-mail is already in the database, EXCEPT That users? That's the problem I need to get around. I really really need help here. Thanks
  20. Check in functions.php for any whitespace or characters after your closing PHP tag. Check for returns, etc. This is usually what causes that problem. More info: [a href=\"http://forums.phpcoin.com/index.php?showtopic=1629\" target=\"_blank\"]http://forums.phpcoin.com/index.php?showtopic=1629[/a]
  21. gfX

    eregi help

    Thanks for your reply, However for some reason it is not working. And it is allowing me to add folders with those characters in it. And when I don't type anything and I just hit enter - This is what I get: Warning: preg_match(): Compilation failed: unmatched parentheses at offset 27 in /**/**/gallery.php on line 166 1. You must enter a folder name. Edit: Nevermind I Ijust took those parenthesis out and it works fine. Thanks so much
  22. Try: [code] $nletter = stripslashes($_POST['post']); $nsubject = stripslashes($_POST['subject']); [/code]
  23. gfX

    eregi help

    Here is what I have: [code] if(eregi("'", $_POST['fn'])) {         $error[] = "<strong class=\"error\">You entered an invalid character.</strong>";         $show = 'y';     } [/code] How would I make it so I can have a bunch of characters listed in that one line. Like I want ' " ! @ # $% ^ & * ( ) : ; {} [ ] > < etc. to have an error if entered. right now it only gives the error for the symbol ' it always messes up if I try to add the rest in there, with commas or whatever. I dont know the formula its supposed to go in anyone know?
  24. If the password they entered is [b]whatever[/b] then they will be redirected to index.php. if anything different, they will be redirected to whatever.php Change to fit your needs.
  25. [code] <? //secondpage.php $password = $_POST['password']; if($password == "whatever") { header("Location: index.php"); } else { header("Location: whatever.php"); } ?> [/code] [code] <!-- somepage.html --> <form method="post" action="secondpage.php"> Password:<BR> <input type="password"><BR><BR> <input type="submit" value="Submit"> </form> [/code]
×
×
  • 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.