Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. Ok i finaly got this to work ... It's not hard ... it's just porly explained <?php chdir("board/"); require('./global.php'); chdir("../"); $vboptions['homeurl'] = $vbulletin->options['homeurl']; $vboptions['bburl'] = $vbulletin->options['bburl']; $vboptions['bbtitle'] = $vbulletin->options['bbtitle']; $vboptions['forumhome'] = $vbulletin->options['forumhome']; $vboptions['contactuslink'] = $vbulletin->options['contactuslink']; $bbuserinfo['userid'] = $vbulletin->userinfo['userid']; $bbuserinfo['usergroupid'] = $vbulletin->userinfo['usergroupid']; $bbuserinfo['username'] = $vbulletin->userinfo['username']; $bbuserinfo['email'] = $vbulletin->userinfo['email']; $session['sessionurl'] = $vbulletin->session->vars['sessionurl']; $session['sessionhash'] = $vbulletin->session->vars['sessionhash']; ?> <table border="0" cellspacing="5" cellpadding="0" align="center"> <tr> <form action='/board/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5password)'> <SCRIPT type=text/javascript src="http://dramis.info/board/clientscript/vbulletin_md5.js?v=384"></SCRIPT> <td> <?php if ($bbuserinfo['userid']!=0){ echo "<center>Welcome back ".$bbuserinfo['username']."!<br><a href='index.php?log=fermer'>Logout</a><center>"; }else{ print ('<table border="0" cellSpacing="3" cellPadding="0"> <tr> <td colSpan="2"> <input accessKey="u" onblur="clickrecall(this,\'Username\')" id="navbar_username" class="search" onfocus="if (this.value == \'User Name\') this.value = \'\';" tabIndex="101" onclick="clickclear(this, \'Username\')" value="Username" size="19" name="vb_login_username"></td> <td class="smallfont" noWrap> <label for="cb_cookieuser_navbar"> <input accessKey="c" id="cb_cookieuser_navbar" tabIndex="103" value="1" type="checkbox" name="cookieuser"></label></td> </tr> <tr> <td colSpan="2"> <input id="navbar_password" class="search" tabIndex="102" size="19" type="password" name="vb_login_password"></td> <td> <input accessKey="s" class="search" title="Enter your username and password in the boxes provided to login, or click the \'register\' button to create a profile for yourself." tabIndex="104" value="Log in" src="http://dramis.info/images/ok.jpg" type="image" name="I1"></td> </tr> </table> <input type="hidden" name="s"> <input value="guest" type="hidden" name="securitytoken"> <input value="login" type="hidden" name="do"> <input type="hidden" name="vb_login_md5password"> <input type="hidden" name="vb_login_md5password_utf">'); } ?> </td> </form> </tr> </table> Works like a charme
  2. Hey guys i have a vbulletin website and i wanted to use the member systeme for my website. So fare it's not looking to good. I have been cheking the web for solutions but nothing ... I tryed 2 things so fare ... 1. Include the global.php file and added a form to login to the board from my homepage. When i log i get the welcome message then i am redirected back to the home page but i am not loged in. I made a print_r($vbulletin) and the userid stays to 0 so the login did not save. If i take out the global.php file and try to log in i get the same message but when i go back on the board i am logged in. kind of weird ... 2. I tryed to tweek the login.php file and insert sessions. I added the session_start to the global.php file and in my homepage then added $_SESSION['username'] = $vbulletin->GPC['vb_login_username']; after the log in but for some reason the session is not created ... I am out of options.
  3. Hey guys i need to teste if an image exists or not ... and my function returns true what ever i put in it ... function url_exists($url) { $hdrs = @get_headers($url); return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false; } The function needs to be as faste as possible because it has to teste 300 jpg image on page load
  4. Yeah it's almost that. I am trying to get 1000 times 1000 the double loop you gave me never increments the seconde loop 00000-00001 00000-00002 00000-00003 00000-00004 [...] 00000-00999 i need it to start over the loop with 00002-00001 and so on untile i get 00999-00999
  5. works but my code is not ... i am trying to increment 2 numbers and for some reason they both return 000 and 0000 WHILE ($counter1 < 1000){ $counter1 = str_pad((int) $counter1,3,"0",STR_PAD_LEFT); WHILE ($counter2 < 1000){ $counter2 = str_pad((int) $counter2,4,"0",STR_PAD_LEFT); echo $counter1."-".$counter2; $counter2++; } $counter1++; }
  6. Hey guys i need to create a 00001 number in a loop. Is there a better way of forcing a 5 digit number then counting them and adding the missing zeros?
  7. you should use cron jobs and for the userinterface javascript or ajax ;-) good luck
  8. OMG ... this is sooooo stupid !!! When i updated my script with the new image upload, i forgot to take out the old one ... // Move the file if (move_uploaded_file($_FILES['image']['tmp_name'], 'uploads/' . $rand . $_FILES['image']['name'])) { $image = $rand . $_FILES['image']['name']; } else { $message = $message = "- There was an error moving the file.<br>"; } When the file was moved the tmp was deleted by PHP ... So the seconde script trying to upload did not work ... Grrr ... No idea why i forgot that ... sorry abbout that MadTechie. I guess we would of found it faster if i would of provided you the full code.
  9. No it's not a permission prob httpdocs/mtlmode/administration/function.php That's where the function is httpdocs/mtlmode/administration/pub.php That's where the function is used httpdocs/mtlmode/media/small/ That's where the file is uploaded to Both "media" and "small" are set to 777 and the groups are good as well The string to acess the download directory used from mtlmode/administration/pub.php is ../media/small/ I tryed your code and fixed the missing ) of if(is_readable($tmpfname ){ But it returned nothing.
  10. Yeah the ini_set() did not work. So i got my self a copy of his php.ini file and found out that the upload_tmp_dir is set to php delfault. As for your new code i got the Error moving file message
  11. Yeah same problem ... the tmp folder is empty ... Can we set tmp folder else where by php_ini() or htaccess? i wander if it's a bad php setting on that host
  12. Hey guys i have been using a working upload and resize function for some time now. It's used on a lot of my websites but for some reason i can't make it work in this projet. The files is realy uploaded Array ( [image] => Array ( [name] => 4186-Porte_int_rieur24__1600x1200_.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpl9dEYT [error] => 0 [size] => 95748 ) ) But for some reason /tmp/phpl9dEYT seems to be returning an error Warning: getimagesize(/tmp/phpl9dEYT) [function.getimagesize]: failed to open stream: No such file or directory in /var/www/vhosts/cameleonmedia.com/subdomains/patrick/httpdocs/mtlmode/administration/function.php on line 280 Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /var/www/vhosts/cameleonmedia.com/subdomains/patrick/httpdocs/mtlmode/administration/function.php on line 298 Warning: imagecreatefromjpeg(/tmp/phpl9dEYT) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /var/www/vhosts/cameleonmedia.com/subdomains/patrick/httpdocs/mtlmode/administration/function.php on line 299 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /var/www/vhosts/cameleonmedia.com/subdomains/patrick/httpdocs/mtlmode/administration/function.php on line 300 Warning: imagejpeg(): supplied argument is not a valid Image resource in /var/www/vhosts/cameleonmedia.com/subdomains/patrick/httpdocs/mtlmode/administration/function.php on line 301 This is my code 2 function. 1 is to upload and 1 is to rename function nomValide($tmp){ $accents = "ÀÃÂÃÄÅà áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÃÃŽÃìíîïÙÚÛÜùúûüÿÑñ"; $pasaccents = "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"; $autorises = ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; $tmp = strtr($tmp,$accents,$pasaccents); for($i=0;$i<strlen($tmp);$i++){ if(!ereg($tmp{$i},$autorises)){ $tmp = str_replace($tmp{$i},'_',$tmp); } } return $tmp; } function photo($image,$largeur_maximum,$destination){ $autorises = 'gifjpegjpgpngGIFJPEGJPGPNG'; $extension = explode('.',$destination); $extension = strtolower($extension[sizeof($extension)-1]); if(ereg($extension,$autorises)){ $dimensions = getimagesize($image); $largeur_actuelle = $dimensions[0]; $hauteur_actuelle = $dimensions[1]; if ($largeur_maximum=="original"){ $nouvelle_largeur = $dimensions[0]; $nouvelle_hauteur = $dimensions[1]; }else{ if($largeur_actuelle > $largeur_maximum){ $nouvelle_largeur = $largeur_maximum; $nouvelle_hauteur = $hauteur_actuelle / ($largeur_actuelle / $largeur_maximum); } else { $nouvelle_largeur = $dimensions[0]; $nouvelle_hauteur = $dimensions[1]; } } if($extension == 'jpg' || $extension == 'jpeg'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefromjpeg($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagejpeg($image_p,$image); } else if($extension == 'gif'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefromgif($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagegif($image_p,$image); } else if($extension == 'png'){ $image_p = imagecreatetruecolor($nouvelle_largeur, $nouvelle_hauteur); $image = imagecreatefrompng($image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nouvelle_largeur, $nouvelle_hauteur, $largeur_actuelle, $hauteur_actuelle); imagepng($image_p,$image); } copy($image,$destination); } } And when i wana use it i simply do this: if ($_FILES['image']['size'] != "0") { $rand = rand("1000", "90000") . "-"; photo($_FILES['image']['tmp_name'],150,'../media/small/'.$rand.nomValide($_FILES['image']['name'])); } Like i said it has been working great on other websites. Before you ask, YES ../media/small/ exist and is chomoded to 777. So wa da ya think?
  13. Thats what i will do in the future but the projet is very very big and changing that would require more time then it did to comme up with that solution.
  14. Found a work arround This is what i did: SELECT * , replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( replace( titre, 'É', 'E' ) , 'é', 'e' ) , 'È', 'E' ) , 'è', 'e' ) , 'À', 'A' ) , 'à', 'a' ) , 'Ê', 'E' ) , 'ê', 'e' ) , 'Î', 'I' ) , 'î', 'i' ) , 'Ç', 'C' ) , 'ç', 'c' ) , 'Ï', 'I' ) , 'ï', 'i' ) , 'Û', 'U' ) , 'û', 'u' ) , 'Ù', 'U' ) , 'ù', 'u' ) AS tt FROM page ORDER BY tt ASC LIMIT 0 , 10 Hope that helps somebody else in the future ;-) Cheers
  15. I tryed this SELECT * FROM page where semaine!='0' and publier = '1' order by REPLACE('&#201;','E', REPLACE('&#233;','e', REPLACE('&#200;','E', REPLACE('&#232;','e', REPLACE('&#192;','A', REPLACE('&#224;','a', REPLACE('&#202;','E', REPLACE('&#234;','e', REPLACE('&#206;','I', REPLACE('&#238;','i', REPLACE('&#199;','C', REPLACE('&#231;','c', REPLACE('&#207;','I', REPLACE('&#239;','i', REPLACE('&#219;','U', REPLACE('&#251;','u', REPLACE('&#217;','u', REPLACE('&#249;','u', titre)))))))))))))))))) asc limit 0,10 But that did not work as well ...
  16. Hey guys i need to sort by title asc articles in a french website. The problem i am facing is that the titles are HTML encoded before they're added to the database. Some foreign special characters are causing the SQL order by argument not usable. Ex: É is encoded to &#201; The order by only sees the first character & and places that article on top instead on sorting them with the E ... So this is what i tryed as an alternat methode to the sql sorting but it's obviously not working ... $select = mysql_query("SELECT * FROM $table where semaine!='0' and publier = '1' limit $offset,$nombre_par_page") or die(mysql_error()); $page = mysql_fetch_array($select); foreach ($page as $value){ $value=html_entity_decode($value); } $page = sort($value); while ($page) { // The SQL result loop echo "$page[titre]<br>"; }
  17. Hmm indeed this can work ... Thks bro this was abbout to make something a lot more complicated lol
  18. Hey guys ... i need help ... I have 2 folders with thousands of mp3 files in each. The names are diffrent but it's the same dame thing inside ... i need to associate 1 to the other in a DB. How can i compare and find matches?
  19. Yeah thats what i thought too ... but i was hopping for a magique function that would encode the col directly in the SQL line ... :-( something like SELECT * FROM lexique WHERE ( titre like 'Â%' or titre like 'À%' or titre like 'â%' or titre like 'à%' or LOWER(titre) like 'a%' ) order by html_entity_decode(titre) asc limit 0, 15
  20. Hey guys ... how do you order a table by title asc when the first character are special characters like é or ê html encoded ? Once encoded they look like this : &#233; and &#234; So when i try to sort them MySQL see's the & and places them at the begining ... How can i do this ?
  21. I know i could simply do something like titre = '$value%' but if theres more then one word it would do a fals positive when it comes to show them in an other code
  22. Hey guys i need to create a function that tests if the first letter is found in a table... works great for the normal abc characters but ia m having a problem taking care of the special french characters This is what i got: function check_l($lettre, $categ){ if ($lettre == "a"){$str = "a, à, â"; }elseif ($lettre == "e"){$str = "e, é, è, ê"; }elseif ($lettre == "c"){$str = "c, ç"; }elseif ($lettre == "i"){$str = "i, î, ï"; }else{ $str = $lettre; } $explode = explode (', ', $str); foreach ($explode as $value){ $nb = $nb + @current(@mysql_fetch_assoc(@mysql_query("SELECT count(id) FROM page where LOWER(LEFT(titre,1)) = '$value' and publier = '1' and categ='$categ'"))); } return $nb; } The problem is that the title in the table is HTML encoded so the special character "à" for exemple would be equal to &#224;. Now knowing that, the above LOWER(LEFT(titre,1)) would only see the first character of the HTML encoded "à" wich would be "&". How can i html_entity_decode the LOWER(LEFT(titre,1)) expression an easy and clean way? LOWER(LEFT(html_entity_decode(titre),1)) is not working ...
  23. Yeah well ai m trying to load the result of a page into a WYSIWYG html texterea. The php page builds up all the blocks and stuff for a weekly newsletter template. It's also used for the clients to see a web version of the email.
  24. Nop the ob thing is not working ...
  25. Hey guys i need to put inside a var a hole php file with all the loops ... Ex $var = include ("page.php"); so i can then use $var and do what ever with it How can i do that?
×
×
  • 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.