Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. Hey guys i am trying to resize a flash object but ia m having a hard time finding the logic to retrive the new height after the width resize. $info = getimagesize("uploads/$categ_list[flash]"); if ($info[0] > "645") { $w = "width='645'"; $dif = $info[0] - 645; $height = $info[1] - $dif; $h = "height='$height'"; } This works for the width but not for the height. Any idea?
  2. nvm ... found my error ... was stupid lol thx anyway ;-)
  3. I just removed the notice becaus there was alot for nothing lol E_ALL & ~E_NOTICE Once your logged in you should see 2 debug tables. One inside the iframe and one under the iframe.
  4. Yes i know lol i can see notices in my page but no php errors Go try it your self. I sent you a private message with the link and logging
  5. Yes those are just code exemples because the whole thing would make to much code for nothing ... but i have a debug line that looks like this in the config.php file if ($debug=="1"){ error_reporting(E_ALL); } and of course $debug is set to 1 Yeah i know i tryed to refresh the page with out sending back the post info and the sessions are remaning so i can asume they are well propageded. + the echo "<pre>"; print_r($_SESSION); echo "</pre>"; returns all the values set
  6. No idea dude ... i made a echo "<pre>"; print_r($_SESSION); echo "</pre>"; on both ... looks like for some reason the seconde session start is not working. The $_SESSION values are all working fine in the index.php file but are all empty in the member.php one ... Do you think i need to force the SID in the link of the iframe?
  7. Yeah but thats not whats causing the problem.
  8. Hey guys ... i have a small session problem. I am creating an admin section that uses an iframe systeme so the only thing that loads in the center part. The probem i have is that the session only works on the index part but not in the center part. Both has the config file included on top where the session is initialized and started. index.php code exemple: <?php include ("config.php"); ?> <html> <head> <title>Admin</title> </head> <body> <table border="0" cellpadding="3" cellspacing="3" width="100%" id="table1"> <tr> <td width="20%"><a href="member.php" target="center">Center</a></td> <td><iframe width="96%" src="member.php" name="centre" id="centre" height="1200" border="0" frameborder="0"></iframe></td> </tr> </table> </body> </html> config.php code exemple: <?php session_start(); // DB $DB_HOST = "localhost"; // Host de la base de donnée $DB_USERNAME = "***"; // Pseudo de la base de donnée $DB_PASSWORD = "***"; // Passe de la base de donnée $DB_NAME = "***"; // Nom de la base de donnée $PHPEcono = mysql_connect("$DB_HOST", "$DB_USERNAME", "$DB_PASSWORD") or die ('Connection à la DB impossible: '.mysql_error()); mysql_select_db($DB_NAME); if ($_POST[connexion] == "Entrer"){ // Start loging check if ($_POST[pseudo]==""){$message = $message." - Votre pseudo est vide.<br>";} if ($_POST[pass]==""){$message = $message." - Votre mot de passe est vide.<br>";} // select $all = mysql_fetch_assoc(mysql_query("SELECT * FROM membre WHERE pseudo='$_POST[pseudo]' and pass='$_POST[pass]'")); if ($all[id]==""){$message = $message." - La combinaison Pseudo/Mot de passe que vous avez entré n'est pas bonne. Si vous avez besoin d'assistance, veuillez SVP communiquer avec nous pendant les heures de bureau et il nous fera plaisir de vous aider.<br>";} if ($message=="" and $all[id]!=""){ // session activation $_SESSION[status] = $all[status]; $_SESSION[pseudo] = $all[pseudo]; $_SESSION[pass] = $all[pass]; $_SESSION[email] = $all[email]; $_SESSION[id] = $all[id]; } } ?> member.php code exemple: <?php include ("config.php"); echo "$_SESSION[status]"; ?> So sessions work in the index but not in the iframe (member.php) they both have the config.php included so wtf? lol
  9. Thx bro that got me on the way :-)
  10. Hey guys ia m trying to create a code that seperates a database result into pages. The code works greate but i am bloking on the part to show only 9 pages at the time in the page menu. Ex: At page 2 the output would look like this << | < | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | > | >> At page 10 the output would look like this << | < | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | > | >> This is the code i made so fare ... The total number of rows is $artiste_nombre and the total number per page is $nombre_par_page the current page is $_GET I just don't get how to make this working ... $maxPage = ceil($artiste_nombre / $nombre_par_page); for ($page = 1; $page <= $maxPage; $page++) { if ($page == $num_page) { $nav .= '<td class="greytable2" align="center" width="25">'.$page.'</td>'; } else { $nav .= '<td class="greytable2" align="center" width="25"><a href="index.php?mod=page&id='.$_GET[id].'&page='.$page.'">'.$page.'</a></td>'; } } if ($num_page > 1) { $page = $num_page - 1; $prev = '<td class="greytable2" align="center" width="25"><a href="index.php?mod=page&id='.$_GET[id].'&page='.$page.'"><</a></td>'; $first = '<td class="greytable2" align="center" width="25"><a href="index.php?mod=page&id='.$_GET[id].'&page=1"><<</a></td>'; } else { //$prev = ' '; //$first = ' '; } if ($num_page < $maxPage) { $page = $num_page + 1; $next = '<td class="greytable2" align="center" width="25"><a href="index.php?mod=page&id='.$_GET[id].'&page='.$page.'">></a></td>'; $last = '<td class="greytable2" align="center" width="25"><a href="index.php?mod=page&id='.$_GET[id].'&page='.$maxPage.'">>></a></td>'; } else { //$next = ' '; //$last = ' '; } // Navigation print ("$first $prev $nav $next $last");
  11. i know ... i have a code that filtrer out the $_POST, $_GET, $_COOKIE, $_REQUEST, $_FILES vars in my header
  12. Hey guys ... is there any other way of doing this with out using imagetruecolortopalette? The qualaty output is awful ... $simg = imagecreatefromjpeg("$idir" . $url); $currwidth = imagesx($simg); $currheight = imagesy($simg); if ($currheight > $currwidth) { $zoom = $twidth / $currheight; $newheight = $theight; $newwidth = $currwidth * $zoom; } else { $zoom = $twidth / $currwidth; $newwidth = $twidth; $newheight = $currheight * $zoom; } $dimg = imagecreate($newwidth, $newheight); imagetruecolortopalette($simg, false, 256); $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { $colors = ImageColorsForIndex($simg, $i); ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); imagejpeg($dimg, "$tdir" . $url); imagedestroy($simg); imagedestroy($dimg);
  13. hey guys i created a small photo gallery for a client. he asked 1 photo per page with a description. he has abbout 50 pages total. He would like only 10 pages listed at the time. so if the member is at page 11 page 11 should be in the middle [Previous] 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 [Next] and if the guy is at 12 [Previous] 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 [Next] This is the code i have so fare to liste the pages <?php $i=1; $phpecono1 = mysql_query("SELECT * FROM photo where id_page='$_GET[id]'") or die (mysql_error()); while($photo = @mysql_fetch_array($phpecono1)){ if ($_GET[photoid]=="$photo[id]"){$thiss="<strong>$i</strong>";}else{$thiss=$i;} print ('<td align="center" width="25"><font size="1" face="Verdana" color="#FFFFFF"><a href="index.php?mod=page&photoid='.$photo[id].'&id='.$_GET[id].'">'.$thiss.'</a></font></td>'); $i++;} ?> How can i limite to only 10 pages?
  14. Hey guys ... for some reason i am trying to upload more then 1 file but the only one taken charge is the first one ... Why? <?php // POST Debug echo '<pre>'; print_r($_POST); echo '</pre>'; echo '------------<pre>'; print_r($_FILES); echo '</pre>'; $idir = "../images/"; // Path To Images Directory $tdir = "../images/thumbs/"; // Path To Thumbnails Directory $twidth = "79"; // Maximum Width For Thumbnail Images $theight = "59"; // Maximum Height For Thumbnail Images if ($_POST) { $insert = mysql_query("INSERT $table (id, marque, prix, anne, modele, description) VALUE ('', '$_POST[marque]', '$_POST[prix]', '$_POST[anne]', '$_POST[modele]', '$_POST[description]')") or die(mysql_error()); $show = "3"; // profile // debug $count = count($_FILES['userfile']['name']) + 1; echo "<h1>There is : $count</h1><br>"; for ($i = 0; $i < $count; $i++) { $rand = rand("1000", "90000") . "-"; echo "- Image num: $i<br>"; if ($_FILES['userfile']['size'][$i] != "0") { echo "($i) " . $_FILES['userfile']['name'][$i] . " Prix en charge<br>"; $_FILES['userfile']['name'][$i] = $rand . $_FILES['userfile']['name'][$i]; // Uploading/Resizing Script $url = $_FILES['userfile']['name'][$i]; // Set $url To Equal The Filename For Later Use if ($_FILES['userfile']['type'][$i] == "image/jpg" || $_FILES['userfile']['type'][$i] == "image/jpeg" || $_FILES['userfile']['type'][$i] == "image/pjpeg") { $file_ext = strrchr($_FILES['userfile']['name'][$i], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['userfile']['tmp_name'][$i], "$idir" . $_FILES['userfile']['name'][$i]); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location print 'Image uploaded successfully.<br />'; // Was Able To Successfully Upload Image $simg = imagecreatefromjpeg("$idir" . $url); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "$tdir" . $url); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image print 'Image thumbnail created successfully.'; // Resize successful } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } else { print '<font color="#FF0000">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is '; // Error Message If Filetype Is Wrong print $file_ext; // Show The Invalid File's Extention print '.</font>'; } } } } ?> Array ( [anne] => [marque] => 10 [model] => [prix] => [description] => [b1] => Ajouter ) ------------ Array ( [userfile] => Array ( [name] => Array ( [0] => [1] => avatar-63671.jpg [2] => drisate_1.jpg ) [type] => Array ( [0] => [1] => image/pjpeg [2] => image/pjpeg ) [tmp_name] => Array ( [0] => [1] => /tmp/phpyCD6Ag [2] => /tmp/php6h5K01 ) [error] => Array ( [0] => 4 [1] => 0 [2] => 0 ) [size] => Array ( [0] => 0 [1] => 7741 [2] => 12852 ) ) )
  15. Hey guys, I am having problems with uploading and resizing multiple images. For some reason the thumbnails are not created because theres an infinit loop on the first image copy() ... I dont get it :-( <? $count = count($_FILES['userfile']['name']); for($i=0; $i < $count; $i++){ echo "- Image num: $i<br>"; $rand =rand("1000", "90000")."-".rand("1000", "90000")."-"; if ($_FILES['userfile']['name'][$i]!=""){ echo "($i) ".$_FILES['userfile']['name'][$i]." Prix en charge<br>"; // Uploading/Resizing Script $url = $_FILES['userfile']['name'][$i]; // Set $url To Equal The Filename For Later Use if ($_FILES['userfile']['type'][$i] == "image/jpg" || $_FILES['userfile']['type'][$i] == "image/jpeg" || $_FILES['userfile']['type'][$i] == "image/pjpeg") { $file_ext = strrchr($_FILES['userfile']['name'][$i], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['userfile']['tmp_name'][$i], "$idir" . $rand . $_FILES['userfile']['name'][$i]); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location print 'Image uploaded successfully.<br />'; // Was Able To Successfully Upload Image $simg = imagecreatefromjpeg("$idir" . $url); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "$tdir" . $rand . $url); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image print 'Image thumbnail created successfully.'; // Resize successful } else { print '<font color="#FF0000">ERROR: Unable to upload image.</font>'; // Error Message If Upload Failed } } else { print '<font color="#FF0000">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is '; // Error Message If Filetype Is Wrong print $file_ext; // Show The Invalid File's Extention print '.</font>'; } } } ?> $count is = to 4 so something else is causing the infinit loop ... If i comment out everything inside the loop and echo $_FILES['userfile']['name'][$i] i can see al the image names to upload ... so the problem is the copy thing :-(
  16. lol yeah ... umm let me try again User 23 has 2 contacts [email protected] [email protected] In the referal page he has 5 referals. I need to count the number of referals that are not in the contact list. In this case the awnser would be 2 Then in an other page i need to fetch them then loop them
  17. Hey guys, I am trying to make a MySQL query but i am not sure how to build it up ... I need to count the numbers of members that are not added to the users contact list for a giving member id from the user table provided below. The "user_id" col in the contact table is the member to who the contact belongs to not the user id of the contact ... that's what complicates everything ... CREATE TABLE IF NOT EXISTS `contact` ( `id` int(9) NOT NULL auto_increment, `user_id` int(9) NOT NULL, `name` varchar(50) NOT NULL, `username` varchar(50) NOT NULL, `address` varchar(250) NOT NULL, `cp` varchar(50) NOT NULL, `tel_h` varchar(100) NOT NULL, `tel_w` varchar(100) NOT NULL, `tel_c` varchar(100) NOT NULL, `note` blob NOT NULL, `added_date` varchar(100) NOT NULL, `blessingstairs_ref` int(9) NOT NULL, `email` varchar(250) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; CREATE TABLE IF NOT EXISTS `jos_users` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `username` varchar(150) NOT NULL default '', `email` varchar(100) NOT NULL default '', `password` varchar(100) NOT NULL default '', `usertype` varchar(25) NOT NULL default '', `block` tinyint(4) NOT NULL default '0', `sendEmail` tinyint(4) default '0', `gid` tinyint(3) unsigned NOT NULL default '1', `registerDate` datetime NOT NULL default '0000-00-00 00:00:00', `lastvisitDate` datetime NOT NULL default '0000-00-00 00:00:00', `activation` varchar(100) NOT NULL default '', `params` text NOT NULL, `referenced_by` int(99) NOT NULL, `referenced_to` int(99) NOT NULL, `cron_start` varchar(40) NOT NULL, `cron_end` varchar(40) NOT NULL, `cron` varchar(40) NOT NULL, PRIMARY KEY (`id`), KEY `usertype` (`usertype`), KEY `idx_name` (`name`), KEY `gid_block` (`gid`,`block`), KEY `username` (`username`), KEY `email` (`email`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=509 ;
  18. never mind, the code works. the problem was else where sorry ;-)
  19. hey guys i rarely need to use arrays with databases but i need to get tho this result $aUsers = array( "Ädams, Egbert", "Altman, Alisha" ); but in a mysql loop ... i tryed this $safe_check = mysql_query("SELECT * FROM contact where user_id='$_GET[ref]'") or die (mysql_error()); while($temp = @mysql_fetch_array($safe_check)){ $aUsers[] = "$temp[name]"; } but thats not working
  20. Hey guys i need to retreive vars from a foreign website but i am very bad with regular expretions. I need to retreive from a board page the username and posted date for every treads of the page the HTML looks like this and i need to retreive the red parts: ------------------------------------- <table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder"> <tr align="left"> <td class="tablea" valign="top"><a name="post7580219" id="post7580219"></a> <table style="width:100%" cellpadding="4" cellspacing="0" border="0" class="tablea_fc"> <tr> <td style="width:100%" class="smallfont"><span class="normalfont"><b> <a href="profile.php?userid=31486"> Da LaZ </a></b></span> <br /> Heavy Fighter <br /> <img src="en_images_ogame/star2.gif" border="0" alt title /><img src="en_images_ogame/star2.gif" border="0" alt title /><img src="en_images_ogame/star2.gif" border="0" alt title /> <br /> <br /> <img src="images/avatars/avatar-49031.jpg" border="0" alt="images/avatars/avatar-49031.jpg" title /><br /> <br /> Registration Date: 03-10-2006<br /> Posts: 1,102<br /> Universe: uni1<br /> Alliance: pirates<br /> <br /> <img src="en_images_ogame/spacer.gif" width="159" height="1" border="0" alt title /></td> </tr> </table> </td> <td class="tablea" valign="top" style="width:100%"> <table style="width:100%" cellpadding="4" cellspacing="0" border="0" class="tablea_fc"> <tr> <td style="width:100%" class="normalfont" align="left"> <table style="width:100%" cellpadding="4" cellspacing="0" border="0" class="tablea_fc"> <tr> <td><span class="smallfont"><b>evil vs POW</b></span></td> <td align="right" nowrap="nowrap"> <a href="addreply.php?postid=7580219"> <img src="en_images_ogame/replypost.gif" border="0" alt="Reply to this Post" title="Reply to this Post" /></a> <a href="addreply.php?action=quote&postid=7580219"> <img src="en_images_ogame/quote.gif" border="0" alt="Post Reply with Quote" title="Post Reply with Quote" /></a> <a href="editpost.php?postid=7580219"> <img src="en_images_ogame/editpost.gif" border="0" alt="Edit/Delete Posts" title="Edit/Delete Posts" /></a> <a href="report.php?postid=7580219"> <img src="en_images_ogame/report.gif" border="0" alt="Report Post to a Moderator" title="Report Post to a Moderator" /></a> <a href="javascript:self.scrollTo(0,0);"> <img src="en_images_ogame/goup.gif" border="0" alt="Go to the top of this page" title="Go to the top of this page" /></a></td> </tr> </table> <hr size="1" class="threadline" /> <div align="center"> <br /> message</div> </td> </tr> </table> </td> </tr> <tr> <td class="tablea" align="center" nowrap="nowrap"> <span class="smallfont"> <a href="thread.php?postid=7580219#post7580219"> <img src="en_images_ogame/posticon.gif" border="0" alt title /></a> 03-24-2009 <span class="time">02:37</span></span> </td> <td class="tablea" align="left" style="width:100%" valign="middle"> <span class="smallfont"> <img src="en_images_ogame/user_offline.gif" border="0" alt="Da LaZ is offline" title="Da LaZ is offline" /> <a href="search.php?action=user&userid=31486"> <img src="en_images_ogame/search.gif" border="0" alt="Search for Posts by Da LaZ" title="Search for Posts by Da LaZ" /></a> <a href="usercp.php?action=buddy&add=31486"> <img src="en_images_ogame/homie.gif" border="0" alt="Add Da LaZ to your Buddy List" title="Add Da LaZ to your Buddy List" /></a> <a href="pms.php?action=newpm&userid=31486"> <img src="en_images_ogame/pm.gif" border="0" alt="Send a Private Message to Da LaZ" title="Send a Private Message to Da LaZ" /></a> </span></td> </tr> </table> </td> </tr> </table> ------------------------------------- So objective 1, loop the page for every threads objective 2 for each loops, extract the username and posted date If you need a full page exemple, this is one: http://board.ogame.org/thread.php?threadid=537635
  21. I could be wrong but this looks like a header problem So this is obviously an error stoping the page load. Try enabeling all errors. Put this is teh heander of your code error_reporting(E_ALL);
  22. looks like Cory94bailly stole it hahaha
  23. How abbout starting with a proper explanation lol didin't understand a thing hehe
  24. ok do this /*foreach ($row['Score'] as $key => $score) { $weight = $row1['Weight'][$key]; $diff= += ($score - $weight); }*/ echo "<pre>"; print_r($row); echo "</pre>"; And post us the result
  25. Does all the rows have a Score?
×
×
  • 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.