51
xsell
XoopsFormHidden
  • 2010/1/1 5:11

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello

In my Code if i use
new XoopsFormHidden


for Somereason the Form dose not include the $id Value . but if i use
new XoopsFormText
it works and includes the ID value .. but i need it hidden .

after posting with new XoopsFormHidden
the resualt likehttp://localhost/xoops/modules/test/index.php?id=

but with new XoopsFormText , i get exactly wht i want
http://localhost/xoops/modules/test/index.php?id=1

this is the Code with new XoopsFormText which i do not want i want it to work with new XoopsFormHidden

$myts =& MyTextSanitizer::getInstance();
      
$id $myts->makeTboxData4Save($_POST["id"]);
      
 include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";

$xoopsTpl->assign('form1'$form = new XoopsThemeForm(_MI_SEND"form1""send.php"));
$xoopsTpl->assign('id'$the_id = new XoopsFormText(_MI_ID"id"''''$id));

$xoopsTpl->assign('id'$form->addElement($the_id));

$xoopsTpl->assign('send'$submit = new XoopsFormButton("""submit"_MI_SENDNOW"submit"));
$xoopsTpl->assign('send'$form->addElement($submit));
$form->display();



52
xsell
Re: Converting from latin1 to utf8
  • 2009/12/31 6:07

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


All did not work , I converted the tabels to utf8 but the data remains ..ugly ?‡???????£?‡?? ?‡???£?‘?????‰ 1

my MySQL is latin1 and when open the backup file it seems the data already utf8 .. so no need to convert the data ..

so i just converted the tabels to utfs and from the MySQL file i replaced the latin1 with utf8 from the file for all the tabels and saved the file and restored it .. then all the data was ok , so i thought it worked .. but when edit the mainfile.php and replace latin1 with utf8 , all messed up .. which means the data still in latin1 regards the tabel collation in utf8 ..



53
xsell
Re: Converting from latin1 to utf8
  • 2009/12/30 23:21

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Thank Ya All , I will try Out wht u Guys Suggested and Update this Thread later..

@frankblack Actualy i use Latin1 but the Best for me is windows-1256 But Some how i ended up with latin1 :)



54
xsell
Converting from latin1 to utf8
  • 2009/12/30 4:30

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello

I know this Quastion is not easy to asnwer , i tried my best Google this Problem . and i Came up with a tool that Helped me Convert My database from latin1 to utf8 but the Problem is that My data Dose not Show up at all , when Check the MySQL Size , it shown about the Same size before Convert it .

So the Quastion has any one Come with a Good way to Convert from Latin1 or any non utf8 to utf8 without Lose any Data ..

I also Have Searched XOOPS and i came up in different soluations but none worked .



55
xsell
Re: Create Random Name to uploaded file
  • 2009/12/23 7:30

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


That Worked Very Good .. Thank you Man. :)



56
xsell
Re: Create Random Name to uploaded file
  • 2009/12/23 7:22

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


No worry Dylian , I managed to find out the Soluation . its just little Correction of ur code .

$uploader->setTargetFileName($prefix);


That done it and Now i have the files renamed but with one Problem it Dose Not add the file Extenstion to the file name .. it only save's it as 5455. or jdkj. without jpg format or the correct format. any idea?



57
xsell
Re: Create Random Name to uploaded file
  • 2009/12/23 6:57

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Thank you Dylian ,

But that DID not work.

Fatal errorCall to undefined function setTargetFileName()


i have included uploader.php in the code , but for some reason it dose not Recall the settargetname Function.



58
xsell
Re: Create Random Name to uploaded file
  • 2009/12/23 4:00

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Thank you.

@ghia .. thx for the link but that did not help me , i already know how to use the uploader class , I just Can not figuer Out how to rename the file to any random name.


@wishcraft .. Thx .. but i do not know how to apply that in my code .

I tried like this.

$prefix substr(md5(time()),0,7);
$uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH "/" "modules/test/upload/"$allowed_mimetypes$maxfilesize);
if (
$uploader->fetchMedia($_POST["xoops_upload_file"][0], $prefix)) {
    if (!
$uploader->upload()) {


Uploads the file but dose not rename it :)



59
xsell
Create Random Name to uploaded file
  • 2009/12/23 0:49

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello

I use this Code to upload files in my site , I need way to Make the code Create Random Number for the Uploaded File . useing rand () or any other functions.

include_once '../../class/uploader.php';
$allowed_mimetypes = array('image/gif''image/jpeg''image/pjpeg''image/x-png''image/png');
$maxfilesize $xoopsModuleConfig['upload_max_size'];

$uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH "/" "modules/test/upload/"$allowed_mimetypes$maxfilesize);
if (
$uploader->fetchMedia($_POST["xoops_upload_file"][0])) {
    if (!
$uploader->upload()) {

        
redirect_header(XOOPS_URL "/modules/test/index.php" 6""._MI_ATTACHMENTS1."");
    } else {
        echo 
""._MI_SENDME_ATTACHMENTS4."";
    }
} else {

    
redirect_header(XOOPS_URL "/modules/test/index.php" 5""._MI_ATTACHMENTS2."");
}



60
xsell
Re: Try to upload , Always message File not Allowed.
  • 2009/12/22 18:57

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


No worry .. Thank you to whoever Wrote this Snippet.

http://dev.xoops.org/modules/xfsnippet/detail.php?type=snippet&snippet_id=30




TopTop
« 1 ... 3 4 5 (6) 7 8 9 ... 21 »



Login

Who's Online

224 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 224


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits