xoops forums

Forum Index


Board index » All Posts (xsell)




xsell

Quite a regular
Posted on: 2010/1/1 5:11
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#51

XoopsFormHidden

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 like http://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();


xsell

Quite a regular
Posted on: 2009/12/31 6:07
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#52

Re: Converting from latin1 to utf8

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 ..


xsell

Quite a regular
Posted on: 2009/12/30 23:21
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#53

Re: Converting from latin1 to utf8

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 :)


xsell

Quite a regular
Posted on: 2009/12/30 4:30
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#54

Converting from latin1 to utf8

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 .


xsell

Quite a regular
Posted on: 2009/12/23 7:30
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#55

Re: Create Random Name to uploaded file

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


xsell

Quite a regular
Posted on: 2009/12/23 7:22
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#56

Re: Create Random Name to uploaded file

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?


xsell

Quite a regular
Posted on: 2009/12/23 6:57
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#57

Re: Create Random Name to uploaded file

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.


xsell

Quite a regular
Posted on: 2009/12/23 4:00
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#58

Re: Create Random Name to uploaded file

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 :)


xsell

Quite a regular
Posted on: 2009/12/23 0:49
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#59

Create Random Name to uploaded file

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."");
}


xsell

Quite a regular
Posted on: 2009/12/22 18:57
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#60

Re: Try to upload , Always message File not Allowed.

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

http://dev.xoops.org/modules/xfsnippe ... ype=snippet&snippet_id=30



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