xoops forums

Forum Index


Board index » All Posts (mjoel)




mjoel

Quite a regular
Posted on: 1/31 4:47
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#1

Help with extcal mysql table

Hello XOOPS

Im using a modified extcal module ..where i dont want to set time and i want to use only date for event....i would like to update my existing extcal database ...

so that event_start and event_end field of extcal module to have 00:00:00 time

as example from 2012-11-14 08:00:00 to 2012-11-14 00:00:00

the problem is in extcal event_start and event_end are originally in int format

SELECT `event_start`,`event_endFROM `xxx_extcal_event`

Resized Image

i use this query to convert event start and event end to a readable date using this query

SELECT FROM_UNIXTIME(`event_start`),FROM_UNIXTIME(`event_end`) FROM `xxx_extcal_event`

Resized Image


i tried something like to update the time but its not working
UPDATE `xxx_extcal_eventSET FROM_UNIXTIME(`event_start`)=concat(FROM_UNIXTIME(`event_start`), ' 00:00:00'), FROM_UNIXTIME(`event_end`)=concat(FROM_UNIXTIME(`event_end`), ' 00:00:00')


after update event_start and event_end should be back in int format

how do i do this help.. im using phpmyadmin


mjoel

Quite a regular
Posted on: 12/24 3:20
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#2

Re: verify registered user in html

use this

global $xoopsUser
if (!
is_object($xoopsUser)) {
    
redirect_header('index.php'3"You have no permission");
}


check also
https://xoops.org/modules/newbb/viewtopic.php?topic_id=77168


mjoel

Quite a regular
Posted on: 2018/3/24 5:30
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#3

Re: Dummy block in Dummy module

Maybe a new release of the new dummy module by trabis

just some suggestion to add

- dummy block with block template
- add two three pages..
- function add/edit delete
- able to find the pages through search.php
- submenus
- simple admin page

etc

it will be much easier for user


mjoel

Quite a regular
Posted on: 2018/3/24 5:22
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#4

Re: mysql_error - help with mysql query code in xoops

Thank You Very Much Mamba for the long explanation


mjoel

Quite a regular
Posted on: 2018/3/24 1:08
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#5

mysql_error - help with mysql query code in xoops

Hi

How do i correct this code below using XOOPS standard ?
what do i replace the mysql error with

sorry im a newbie in coding

$employee_id $xoopsDB->escape($_GET['id']);
$check$xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("employee")." WHERE id='$employee_id' ") or die(mysql_error());


mjoel

Quite a regular
Posted on: 2017/3/10 5:37
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#6

Re: TDMDownloads 1.65 RC 1

bump

how do i solved the problem above ?


mjoel

Quite a regular
Posted on: 2017/3/3 1:47
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#7

Re: Bulk user registration with xoops 2.5.8.1

Thank you very much sir...it works perfectly

it will be more complete if it will check in the current db to prevent same username and email


<?php
/**
 * modified from script by christian@frxoops.org
 * Import users from a csv file into xoops 2.5.8
 *
 * Put this file and your users.cvs file in the root of your site
 * go to http://yoursite/import_users.php in your browser
 * click the button to rn the import
 *
 * Don't forget to DELETE it after you run it!
 */
/* Example users.csv file:
Bill;Barra;bill.barra@yahoo.com;changeme
Mark;Knopfler;mark@knopfler.com;changeme
Jim;Morrison;jim.morrison@gmail.com;changeme
Roger;Daltrey;roger@daltrey.com;changeme
*/
// assuming this is in the web root
include 'mainfile.php';
// make sure we run as a POST transaction, so database operations do not need "force"
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    echo 
'<form action="" method="POST"><input type="submit" value="Click to import"></form>';
    exit();
}
$fichier 'users.csv'// data file as : first name(pseudo);last name;email;password
// remove line break on last record
/** @var XoopsMemberHandler $memberHandler */
$memberHandler xoops_getHandler('member');
if (
false === $memberHandler) die("Unable to create member handler");
$time time();
// Open file for read
if (file_exists($fichier))
    
$fp fopen("$fichier""r");
else{ 
// unknown file
    
echo "File not found !Import stopped.n";
    exit();
}
echo 
'<pre>Begin file import '.$fichier."n";
// import line by line
while (!feof($fp)) {
    
$ligne fgets($fp4096);
    if (
'' === trim($ligne)) {
        continue; 
// blank line
    
}
    
$liste explode(";"$ligne); // create array
    
foreach ($liste as $index => $value) {
        
$liste[$index] = trim($value);
    }
    
/** @var XoopsUser $user */
    
$user $memberHandler->createUser();
    
$user->setVar('uname'$liste[0]);
    
$user->setVar('name'$liste[1]);
    
$user->setVar('email'$liste[2]);
    
$user->setVar('pass'md5($liste[3]));
    
$user->setVar('user_regdate'$time);
    
$user->setVar('user_level'1); // activated
    
$user->setVar('user_viewemail'1);
    
$user->setVar('user_avatar''avatars/blank.gif');
    
$uid $memberHandler->insertUser($user);
    if (
false === $uid) {
        echo 
sprintf("Failed to insert user %s n"$liste[0]);
        echo 
"Importation stoppée.n</pre>";
        
fclose($fp);
        exit();
    }
    
$memberHandler->addUserToGroup(XOOPS_GROUP_USERS$uid);
    echo 
sprintf("Record %d - %s addedn"$uid$user->uname());
}
echo 
"Import finished successfully.n</pre>";
fclose($fp);


mjoel

Quite a regular
Posted on: 2017/3/3 1:20
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#8

Re: TDMDownloads 1.65 RC 1

hi im currestly testing upgrading my site in in localhost


XOOPS Version XOOPS 2.5.9-Beta2
PHP Version 5.6.25
mySQL Version 5.7.14
TDM Downloads 1.65 Final

In admin
TDMDownloads/admin/downloads.php?op=new_downloads

i can only see two buttons download list and waiting for validation button..and the rest is white page..turning on debug i received this error


Unknowncall_user_func() expects parameter 1 to be a valid callbacknon-static method DefacerCorePreload::eventSystemClassGuiHeader() should not be called statically in file /class/preload.php line 139
Unknown
Non-static method DefacerCorePreload::eventCoreHeaderAddmeta() should not be called statically in file /modules/defacer/preloads/core.php line 85
Unknown
Non-static method DefacerCorePreload::isActive() should not be called statically in file /modules/defacer/preloads/core.php line 60
Unknown
Only variables should be assigned by reference in file /modules/defacer/preloads/core.php line 196
Unknown
Non-static method DefacerCorePreload::isRedirectActive() should not be called statically in file /modules/defacer/preloads/core.php line 60
Unknown
Only variables should be assigned by reference in file /modules/defacer/class/defacer.php line 156
Unknown
Only variables should be assigned by reference in file /modules/defacer/class/defacer.php line 142
Unknown
Only variables should be assigned by reference in file /modules/defacer/class/defacer.php line 143
Unknown
Only variables should be assigned by reference in file /modules/mylinks/xoops_version.php line 119
Unknown
Only variables should be assigned by reference in file /modules/mylinks/xoops_version.php line 120
Unknown
Only variables should be assigned by reference in file /modules/mylinks/xoops_version.php line 121
Unknown
Only variables should be assigned by reference in file /modules/xoopstube/xoops_version.php line 193
Unknown
Only variables should be assigned by reference in file /modules/xoopstube/xoops_version.php line 194
Unknown
Only variables should be assigned by reference in file /modules/xoopstube/xoops_version.php line 199
Unknown
Only variables should be assigned by reference in file /modules/tag/admin/menu.php line 25
Unknown
Only variables should be assigned by reference in file /modules/tag/admin/menu.php line 26
Unknown
Only variables should be assigned by reference in file /modules/tag/admin/menu.php line 27
Unknown
Only variables should be assigned by reference in file /modules/xoopspoll/admin/menu.php line 39
Unknown
Only variables should be assigned by reference in file /modules/xoopspoll/admin/menu.php line 40
Unknown
Only variables should be assigned by reference in file /modules/xoopspoll/admin/menu.php line 41
Unknown
Only variables should be assigned by reference in file /modules/xforms/admin/menu.php line 30
Unknown
Only variables should be assigned by reference in file /modules/xforms/admin/menu.php line 31
Unknown
Only variables should be assigned by reference in file /modules/xforms/admin/menu.php line 32
Unknown
Only variables should be assigned by reference in file /modules/isearch/xoops_version.php line 95
Notice
: Use of undefined constant _PROFILE_MI_HOME assumed '_PROFILE_MI_HOME' in file /modules/profile/admin/menu.php line 42
Notice
: Use of undefined constant _PROFILE_MI_ABOUT assumed '_PROFILE_MI_ABOUT' in file /modules/profile/admin/menu.php line 66


i have disable all the modules above..but i still have blank page with two button with no error

in the deprecated i have this message XoopsFormTag is deprecated use TagFormTag instead.


mjoel

Quite a regular
Posted on: 2017/3/2 7:33
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#9

Re: Bulk user registration with xoops 2.5.8.1

nevermind the code from here works http://dev.xoops.org/modules/xfmod/pr ... 61&release_id=786&dl=2160

import_users.php
<?php
// christian@frxoops.org - http://www.frxoops.org
// Import users from a csv file into xoops 2.0.x
// 26 january 2006 : add trim() for encrypt password

// variables
$bdd"x20132";
$host"localhost";
$user"root";
$pass"";
$fichier "users.csv"// data file as : first name(pseudo);last name;email;password    
// remove line break on last record

mysql_connect($host,$user,$pass) or die("Unable to connect Database");
mysql_select_db($bdd);

// Open file for read
if (file_exists($fichier))
    
$fp fopen("$fichier""r");
else{ 
// unknown file
    
echo "File not found !Import stopped.";
    exit();
}
echo 
'Begin file import '.$fichier.'';
// import line by line
while (!feof($fp)){
    
$ligne fgets($fp,4096);
    
$liste explode(";",$ligne); // create array 
    
$user $liste[0]; //first field 
    
$name $liste[1]; //second field
    
$email$liste[2];
    
$passmd5(trim($liste[3]));    


    
// Add user in xoops_users table
     
$query "insert into xoops_users  (uname, name, email, pass) VALUES ('$user', '$name','$email','$pass')";

     
     
$resultmysql_query($query);
     
$uid mysql_insert_id();
    
    
//Add user in group : users registered 
    
$numgroup ='2';
     
$query "INSERT INTO xoops_groups_users_link  (groupid, uid) VALUES('$numgroup', '$uid')";
     
$resultmysql_query($query);

     if (
mysql_error()){
      echo 
"Error in database : ".mysql_error();
      echo 
"Importation stoppée.";
      
fclose($fp);
      exit();
}else{
  echo 
"Record ".$uid." - ".$user." added ";
 }
}

echo 
"Import finished successfully.";

fclose($fp);



users.csv
Bill;Barra;bill.barra@yahoo.com;245AVB
Mark
;Knopfler;mark@knopfler.com;AVB245
Jim
;Morrison;jim.morrison@gmail.com;bngh123
Roger
;Daltrey;roger@daltrey.com;XXD23


edit db prefix and it works although it can be improved with adding other field such as user_regdate


mjoel

Quite a regular
Posted on: 2017/3/2 0:03
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#10

Bulk user registration with xoops 2.5.8.1

Hi

I would like to setup an intranet site with 400 plus users

i found a script here
https://xoops.org/modules/newbb/viewtopic.php?post_id=222145#222145
but its not working

<?php 
// christian@frxoops.org - http://www.frxoops.org 
// Import users from a csv file into XOOPS 2.0.x 
// variables 
$db"test"
$host"localhost"
$user"root"
$pass""
$fichier "users.csv"// data file as : user name;real name;email;password    
// remove line break on last record 

mysql_connect($host,$user,$pass) or die("Unable to connect Database"); 
mysql_select_db($db); 

// Open file for read 
if (file_exists($fichier)) 
    
$fp fopen("$fichier""r"); 
else{ 
// unknown file 
    
echo "File not found !Import stopped."
    exit(); 

echo 
'Begin file import '.$fichier.''
// import line by line 
while (!feof($fp)){ 
    
$ligne fgets($fp,4096); 
    
$liste explode(";",$ligne); // create array  
    
$user $liste[0]; //first field  
    
$name $liste[1]; //second field 
    
$email$liste[2]; 
    
$passmd5($liste[3]);     


    
// Add user in xoops_users table 
     
$query "insert into x536_users  (uname, name, email, pass) VALUES ('$user', '$name','$email','$pass')";

      
     
$resultmysql_query($query); 
     
$uid mysql_insert_id(); 
     
    
//Add user in group : users registered  
    
$numgroup ='2'
     
$query "INSERT INTO x536_groups_users_link  (groupid, uid) VALUES('$numgroup', '$uid')";
     
$resultmysql_query($query); 

     if (
mysql_error()){ 
      echo 
"Error in database : ".mysql_error(); 
      echo 
"Importation stoppée."
      
fclose($fp); 
      exit(); 
}else{ 
  echo 
"Record ".$uid." - ".$user." added "
 } 


echo 
"Import finished successfully."

fclose($fp);




anyone can help me so i can add user manually and give them a default password and they will change themsel



TopTop
(1) 2 3 4 ... 23 »