Problem with auto profile generator

Reply

Join Date: Mar 2008
Posts: 95
Reputation: flynismo is an unknown quantity at this point 
Solved Threads: 1
flynismo flynismo is offline Offline
Junior Poster in Training

Problem with auto profile generator

 
0
  #1
Oct 12th, 2008
I just started a site, and would like to make some dummy profiles. The script I'm using included a profile generator that would assign usernames, age and location (city and state) of the "members". The problem I'm having is that the profile generator assigns a city, but not the corresponding state...due to the nature of my site, it is very important that the member's city/state matches up.
If anyone could help me out on this, that would be great...I can post the code (isn't too much; just one page about 400 - 500 lines) if it would help.

Also, my knowledge of php is very limited...this would otherwise be a very simple problem to resolve (the problem with the code is that it is not getting the state out of the database, just the city...but I don't know how to enter the code properly)

Thank you in advance for any help!
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 848
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 68
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Problem with auto profile generator

 
0
  #2
Oct 12th, 2008
Your going to have to post your code.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 95
Reputation: flynismo is an unknown quantity at this point 
Solved Threads: 1
flynismo flynismo is offline Offline
Junior Poster in Training

Re: Problem with auto profile generator

 
0
  #3
Oct 12th, 2008
Originally Posted by R0bb0b View Post
Your going to have to post your code.

Sure thing, here you go...



  1.  
  2. application/x-httpd-php autogenprofile.php
  3. PHP script text
  4.  
  5. <?php
  6.  
  7. /**
  8.  * class pluginTemplate
  9.  *
  10.  * A template to get you started building templates. Rename all pluginTemplate
  11.  * with the name of your plugin
  12.  *
  13.  *
  14.  *
  15.  */
  16. include_once(MODOSDATE_DIR . 'modPlugin.php');
  17.  
  18. class autogenprofile extends modPlugin {
  19.  
  20. /**
  21.   * Holds the language phrases
  22.   *
  23.   * @access private
  24.   */
  25. var $lang;
  26.  
  27. /**
  28.   * Table with generated users
  29.   *
  30.   * @access private
  31.   */
  32. var $lang_autogenprofile_table = "autogenprofile_autogenprofile";
  33. /**
  34.   * Table with generated forms
  35.   *
  36.   * @access private
  37.   */
  38. var $lang_autogenprofile_forms_table = "autogenprofile_forms";
  39.  
  40. /**
  41.   * The name name of the plugin class.
  42.   *
  43.   * @access private
  44.   */
  45. var $plugin_class_name = "autogenprofile";
  46.  
  47. /**
  48.   * The text that appears in the admin plugin list
  49.   *
  50.   * @access private
  51.   */
  52. var $display_name;
  53.  
  54. /**
  55.   * The link text that appears on the user's menu
  56.   *
  57.   * @access private
  58.   */
  59. var $user_menu_text;
  60.  
  61. /**
  62.   * Appear on users menu (true or false)
  63.   *
  64.   * @access private
  65.   */
  66. var $user_menu_appear = false;
  67.  
  68.  
  69. /**
  70.   * The link text that appears on the admin's menu
  71.   *
  72.   * @access private
  73.   */
  74. var $admin_menu_text ;
  75.  
  76. /**
  77.   * Appear on admin's menu (true or false)
  78.   *
  79.   * @access private
  80.   */
  81. var $admin_menu_appear = true;
  82. var $osDB;
  83. /**
  84.   * Constructor
  85.   *
  86.   * @return
  87.   * @access public
  88.   */
  89. function autogenprofile( )
  90. {
  91.  
  92. $this->modPlugin();
  93. $this->osDB =& $GLOBALS['osDB'];
  94. $pluginDir = dirname(__FILE__).'/../';
  95. $this->lang = $this->modLoadLang($pluginDir);
  96. $this->admin_menu_text=$this->lang['user_title'];
  97. $this->display_name=$this->lang['user_title'];
  98. } // end of member method pluginClass
  99.  
  100.  
  101. /**
  102.   * Does the processing to display a user page. Called from plugin.php
  103.   *
  104.   * @return array
  105.   * @access public
  106.   */
  107. function displayPluginPage() {
  108.  
  109. }
  110. /**
  111.   * WARNING: USER IS NOT VALIDATED HERE. BE CAREFUL
  112.   * Does the processing to display 100% plugin content. Called from pluginraw.php
  113.   *
  114.   * @return array
  115.   * @access public
  116.   */
  117. function displayPluginContent() {
  118.  
  119. }
  120. /**
  121.   * Returns the content that will appear in the left column of a page. Designed to be overridden by plugins
  122.   *
  123.   * @return array
  124.   * @access public
  125.   */
  126. function displayLeftCol() {
  127.  
  128. }
  129.  
  130.  
  131. /**
  132.   * Returns the content that will appear in the main content area of the page. This content will appear after the existing main content. Designed to be overridden by plugins
  133.   *
  134.   * @return array
  135.   * @access public
  136.   */
  137. function displayMain() {
  138.  
  139. }
  140.  
  141. function getUserName($firstname,$lastname)
  142. {
  143. $len=(strlen($firstname)+strlen($lastname)+mt_rand(0,9999))%10;
  144. if($len==1) return substr(trim($firstname).trim($lastname),0,24);
  145. if($len==2) return substr(trim($firstname)."_".trim($lastname),0,24);
  146. if($len==3) return $firstname[0].trim($lastname);
  147. if($len==4) return trim($firstname).$lastname[0];
  148. if($len==5) return trim(substr($firstname,0,mt_rand(1,strlen($firstname)))).trim(substr($lastname,0,mt_rand(1,strlen($lastname))));
  149. if($len==6) return trim(substr($firstname,0,mt_rand(1,strlen($firstname)))).trim(substr($lastname,0,mt_rand(1,strlen($lastname)))).mt_rand(1,999);
  150. if($len==7) return $firstname[0].trim($lastname).mt_rand(1,999);
  151. if($len==8) return trim($firstname).$lastname[0].mt_rand(1,999);
  152. if($len==9) return trim($firstname)."_".trim(substr($lastname,0,mt_rand(1,strlen($lastname))));
  153. if($len==0) return trim($firstname).$lastname[0].mt_rand(1,999);
  154. }
  155.  
  156. /**
  157.   * Does the processing to display a admin page. Called from plugin.php
  158.   *
  159.   * @return array
  160.   * @access public
  161.   */
  162. function displayPluginAdminPage() {
  163. $this->modSmartyAssign('lang',$this->modGetLang());
  164. $this->modSmartyAssign('plugin_name',$this->plugin_class_name);
  165. $file_male="male_firstnames.txt";
  166. $file_female="female_firstnames.txt";
  167. $file_firstname="lastnames.txt";
  168. $countries =& $this->modGetAllCountries();
  169. foreach ($countries as $item => $key)
  170. {
  171. if($key['code']=="AA") unset($countries[$item]);
  172. /* Vijay Nair - Want to take cities only for selected countries for generating profiles.
  173. else {
  174.   $cities=$this->modGetAllCities($key['code']);
  175.   if($cities)
  176.   $city[$key['code']]=$cities;
  177.   }
  178. */
  179. }
  180. $path=PLUGIN_DIR.$this->plugin_class_name."/temp/";
  181. // $pathimages=TEMP_DIR."profile_images/";
  182. $pathimages=$path."profile_images/";
  183.  
  184. /* Generation process starts */
  185. if(isset($_POST['generate']))
  186. {
  187. // @ini_set('time_limit','0');
  188. //set_time_limit(0);
  189. //getting data from form
  190. $opt1=$_POST['opt1']; //number of profiles;
  191. $opt2=$_POST['opt2']; //percentage of males
  192. $opt3=$_POST['opt3']; //percentage of females
  193. $opt4=$_POST['opt4']; //number of countries
  194. $opt6=$_POST['opt6']; //percentage of age ranges
  195. $opt8=$_POST['opt8']; //percentage of white ethnicity
  196. $opt9=$_POST['opt9']; //percentage of black ethnicity
  197. $opt10=$_POST['opt10']; //percentage of asian ethnicity
  198. $opt11=$_POST['opt11']; //percentage of other ethnicity
  199.  
  200. if ($opt2 == '' && $opt3 != '') {
  201. $opt2 = 100 - $opt3;
  202. } else if ( $opt3 == '' && $opt2 != '') {
  203. $opt3 = 100 - $opt2;
  204. } else if ($opt2 == '' && $opt3 == '') {
  205. $opt2 = $opt3 = 50;
  206. }
  207.  
  208. $nrmales=(int)($opt1*$opt2/100);
  209. $nrfemales=($opt1-$nrmales);
  210.  
  211. $etn['w']="0"; $etns[0]="10020";
  212. $etn['b']="1"; $etns[1]="10019";
  213. $etn['a']="2"; $etns[2]="10018";
  214. $etn['m']="3"; $etns[3]="10027";
  215.  
  216. $ethnicity[0]['number']=(int)($opt1*$opt8/100);
  217. $ethnicity[1]['number']=(int)($opt1*$opt9/100);
  218. $ethnicity[2]['number']=(int)($opt1*$opt10/100);
  219. $ethnicity[3]['number']=(int)($opt1*$opt11/100);
  220.  
  221. $ethnicity[0]['ethnicity']="10020";
  222. $ethnicity[1]['ethnicity']="10019";
  223. $ethnicity[2]['ethnicity']="10018";
  224. $ethnicity[3]['ethnicity']="10027";
  225. $sum=0;
  226. for($i=0;$i<4;$i++)
  227. {
  228. if(!$ethnicity[$i]['number']) unset($ethnicity[$i]);
  229. $sum+=$ethnicity[$i]['number'];
  230. }
  231. if($sum<$opt1) $ethnicity[4]['number']=$opt1-$sum;
  232. $forms['ethnicity']=$ethnicity;
  233.  
  234. if(file_exists($pathimages))
  235. {
  236. $handle = opendir($pathimages);$file = readdir($handle);$file = readdir($handle);
  237. while (false !== ($file = readdir($handle)))
  238. {
  239. $itemx=explode(".",$file);
  240. $item=$itemx[0];
  241. $item=explode("_",$item);
  242. $img['file']=$file;
  243. $img['age']=$item[1];
  244. $img['ethnicity']=$item[2];
  245. $img['ext']=strtolower($itemx[1]);
  246. $images[strtoupper($item[0])][]=$img;
  247. }
  248. unset($images['THUMBS']);
  249. }
  250.  
  251. /* Countries start */
  252. $sum=0;
  253. $nocount = 0;
  254. for($i=1;$i<=$opt4;$i++)
  255. {
  256. $field1="opt5_$i";
  257. $field2="opt5_{$i}c";
  258. if (!isset($_POST[$field2])) {
  259. /* If country is not selected, take random country */
  260. $rx = mt_rand(0,count($countries)-1);
  261. $_POST[$field2] = $rx;
  262. }
  263. if ($_POST[$field1] != '') {
  264. $country[$i-1]['number']=(int)($opt1*$_POST[$field1]/100);
  265. } else {
  266. $country[$i-1]['number']=0;
  267. $nocount++;
  268. }
  269. $country[$i-1]['country']=$countries[$_POST[$field2]]['name'];
  270. $country[$i-1]['code']=$countries[$_POST[$field2]]['code'];
  271. $sum+=$country[$i-1]['number'];
  272. }
  273. if($sum<$opt1 && $nocount == 0) $country[0]['number']=$opt1-$sum;
  274. if ($nocount > 0) {
  275. /* There are countries records without any percentage allocated. Let us
  276. allocate balance numbers equally to these countries. */
  277. $cnt = $opt1 - $sum;
  278. $cnt1 = 0;
  279. for ($i=0;$i<$opt4;$i++) {
  280. if ($country[$i]['number']==0) {
  281. $country[$i]['number'] = (int)($cnt / $nocount);
  282. $cnt1 += $country[$i]['number'];
  283. }
  284. }
  285. if ($cnt1 < $cnt) {
  286. $country[0]['number']+=$cnt-$cnt1;
  287. }
  288. }
  289.  
  290. $forms['country']=$country;
  291.  
  292. /* Countries end */
  293.  
  294. $sum=0;
  295. $nocount = 0;
  296. if ($opt6 == '') {
  297. $age[0]['min']=16;
  298. $age[0]['max']=90;
  299. $age[0]['number']=$opt1;
  300. } else {
  301. for($i=1;$i<=$opt6;$i++)
  302. {
  303. $field1="opt7_{$i}a";
  304. $field2="opt7_{$i}b";
  305. $field3="opt7_{$i}c";
  306. if ($_POST[$field1] != '') {
  307. $age[$i-1]['number']=(int)($opt1*$_POST[$field1]/100);
  308. } else {
  309. $age[$i-1]['number']=0;
  310. $nocount++;
  311. }
  312. if (!isset($_POST[$field2]) || $_POST[$field2] == '') {
  313. $_POST[$field2] = 16;
  314. }
  315. if (!isset($_POST[$field3]) || $_POST[$field3] == '') {
  316. $_POST[$field3] = 90;
  317. }
  318. $age[$i-1]['min']=$_POST[$field2];
  319. $age[$i-1]['max']=$_POST[$field3];
  320. $sum+=$age[$i-1]['number'];
  321. }
  322. if($opt1 > $sum && $nocount == 0 ) $age[0]['number']=$opt1 - $sum;
  323.  
  324. if ($nocount > 0) {
  325. /* There are age records without any percentage allocated. Let us
  326. allocate balance numbers equally to these. */
  327.  
  328. $cnt = $opt1 - $sum;
  329. $cnt1 = 0;
  330. for ($i=0;$i<$opt6;$i++) {
  331. if ($age[$i]['number']==0) {
  332. $age[$i]['number'] = (int)($cnt / $nocount);
  333. $cnt1 += $age[$i]['number'];
  334. }
  335. }
  336. if ($cnt1 < $cnt) {
  337. $age[0]['number']+=$cnt-$cnt1;
  338. }
  339. }
  340. }
  341. $forms['age']=$age;
  342.  
  343. $male = $female = array();
  344.  
  345. //getting data from name files
  346. $males=file($path.$file_male);
  347. $females=file($path.$file_female);
  348. $firstnames=file($path.$file_firstname);
  349. /* Modified by Vijay Nair to keep only the required number of males and females
  350. names in the $male and $female array. Unnecessary to have all combinations
  351. to be built into array. System errors occur because of this. */
  352.  
  353. $male_names_cnt = count($males);
  354. $female_names_cnt = count($females);
  355. $firstnames_cnt = count($firstnames);
  356.  
  357. // firstnames array is infact last names array
  358. //getting all possible numbers
  359.  
  360. for($i=0;$i<$nrmales;$i++) {
  361. $r1 = rand(0, ($male_names_cnt-1));
  362. $r2 = rand(0,($firstnames_cnt-1));
  363. $male[$i]['firstname'] = $firstnames[$r2];
  364. $male[$i]['lastname'] = $males[$r1];
  365. }
  366.  
  367. for($i=0;$i<$nrfemales;$i++) {
  368. $r1 = rand(0,$female_names_cnt-1);
  369. $r2 = rand(0,$firstnames_cnt-1);
  370. $female[$i]['firstname'] = $firstnames[$r2];
  371. $female[$i]['lastname'] = $females[$r1];
  372. }
  373.  
  374. $h=0;
  375. $j=0;
  376. while($h<$nrmales)
  377. {
  378. $result[$j]=$male[$h];
  379. $result[$j]['gender']="M";
  380. $h++;
  381. $j++;
  382. }
  383. $forms['gender']['male']=$j;
  384. $h=0;
  385. while($h<$nrfemales)
  386. {
  387. $result[$j]=$female[$h];
  388. $result[$j++]['gender']="F";
  389. $h++;
  390. }
  391. $forms['gender']['female']=$j-$forms['gender']['male'];
  392.  
  393. if($forms['gender']['male']+$forms['gender']['female']==0) {$this->modSmartyAssign('error',1);$error=1;}
  394. else {$this->modSmartyAssign('error',2);$this->modSmartyAssign('nrerror',$j);}
  395. $forms=serialize($forms);
  396. $ts=time();
  397. $this->modAddRec($this->lang_autogenprofile_forms_table,array('ts'=>$ts,'form'=>$forms));
  398. $fid=$this->modGetOne($this->lang_autogenprofile_forms_table,array('ts'=>$ts),'id');
  399. $this->modSmartyAssign('fid',$fid);
  400. //select user data and add to database
  401. if(!$error)
  402. {
  403. foreach ($result as $item => $key)
  404. {
  405. do {
  406. $username=$this->getUserName($key['firstname'],$key['lastname']);
  407. $ret =& $this->modGetAllUsers(array('username'=>$username));
  408. } while($ret);
  409. $resultitem=$key;
  410. $resultitem['username']=$username;
  411.  
  412. $sel=array_rand($country);
  413. $cntryprflcnt = $country[$sel]['number'];
  414. $country[$sel]['number']--;
  415. if(!$country[$sel]['country']) {$sel2=array_rand($countries);$resultitem['country']=$countries[$sel2]['name'];$code=$countries[$sel2]['code'];}
  416. else {$resultitem['country']=$country[$sel]['country'];$code=$country[$sel]['code'];}
  417. $resultitem['countrycode']=$code;
  418. if(!$country[$sel]['number']) unset($country[$sel]);
  419.  
  420. /* Take cities for the selected country - Vijay Nair */
  421.  
  422. if (!$city[$code] or count($city[$code]) < 1 ) {
  423. $city = array();
  424. $city[$code] =& $this->modGetAllCities($code, $cntryprflcnt);
  425. }
  426. if($city[$code])
  427. $resultitem['city']=$city[$code][array_rand($city[$code])]['name'];
  428.  
  429. $ok=0;
  430. if($images[$key['gender']])
  431. foreach ($images[$key['gender']] as $item2 => $key2) {
  432. $selage=$key2['age'];
  433. $seletn=$etn[$key2['ethnicity']];
  434. $selfile=$key2['file'];
  435. $selext=$key2['ext'];
  436. $selpath=$pathimages.$selfile;
  437. $ok=0;
  438. if($ethnicity[$seletn]['number']) $ok=1;
  439. else if($ethnicity[4]['number']) $ok=1;
  440. if($ok)
  441. foreach ($age as $item3 => $key3)
  442. {
  443. $selmin=$key3['min'];
  444. $selmax=$key3['max'];
  445. if($selmin<=$selage && $selage<=$selmax) {$ok=2;break;}
  446. }
  447. if($ok==2) {$resultitem['age']=$selage;
  448. if($ethnicity[$seletn]['ethnicity']){
  449. $resultitem['ethnicity']=$ethnicity[$seletn]['ethnicity'];
  450. $ethnicity[$seletn]['number']--;
  451. if(!$ethnicity[$seletn]['number']) unset($ethnicity[$seletn]);
  452. } else {
  453. $resultitem['ethnicity']=$etns[$etn[$key2['ethnicity']]];
  454. $ethnicity[4]['number']--;
  455. if(!$ethnicity[4]['number']) unset($ethnicity[4]);
  456. }
  457.  
  458. $dbimg =& $this->modCreateDbImage($selpath,$selext);
  459. unlink($selpath);
  460.  
  461. $resultitem['image']=$dbimg['pic'];
  462. $resultitem['image_ext']=$selext;
  463.  
  464. $resultitem['imagetn']=$dbimg['tn'];
  465. $resultitem['imagetn_ext']="jpg";
  466.  
  467. unset($images[$key['gender']][$item2]);
  468. $age[$item3]['number']--;
  469. if(!$age[$item3]['number']) unset($age[$item3]);
  470.  
  471. break;}
  472. }
  473. if($ok!=2)
  474. {
  475. $sel=array_rand($age);
  476. $age[$sel]['number']--;
  477. $resultitem['age']=mt_rand($age[$sel]['min'],$age[$sel]['max']);
  478. if(!$age[$sel]['number']) unset($age[$sel]);
  479.  
  480. $sel=array_rand($ethnicity);
  481. if($sel!=4)
  482. {
  483. $ethnicity[$sel]['number']--;
  484. $resultitem['ethnicity']=$ethnicity[$sel]['ethnicity'];
  485. }
  486. else $resultitem['ethnicity']=$etns[mt_rand(0,3)];
  487. if(!$ethnicity[$sel]['number']) unset($ethnicity[$sel]);
  488. }
  489. $tsage = $resultitem['age']*365;
  490. $tsage = mt_rand($tsage+364, $tsage);
  491. $resultitem['birth_day'] = $this->osDB->getOne('select date_add(curdate(), interval -'.$tsage.' day)');
  492.  
  493. $this->modAddUser($resultitem);
  494. $this->modAddRec($this->lang_autogenprofile_table,array('username'=>$resultitem['username'],'fid'=>$fid));
  495.  
  496. }
  497. }
  498.  
  499. }
  500. /* End of generation process */
  501. if($_GET['showforms']==0 && isset($_GET['showforms']))
  502. {
  503. if(isset($_POST['txtdelete']))
  504. {
  505. $fid=$_POST['txtdelete'];
  506. $deldata =& $this->modGetAll($this->lang_autogenprofile_table,array('fid'=>$fid));
  507. foreach ($deldata as $item)
  508. {
  509. $user =& $this->modGetAllUsers(array('username'=>$item['username']));
  510. $uid=$user[0]['id'];
  511. if($uid)$this->modDeleteUser($uid);
  512. }
  513. $this->modDeleteRows($this->lang_autogenprofile_forms_table,array('id'=>$fid));
  514. $this->modDeleteRows($this->lang_autogenprofile_table,array('fid'=>$fid));
  515. unset($deldata);
  516. }
  517. $data =& $this->modGetAll($this->lang_autogenprofile_forms_table,array(),'ts',2);
  518. foreach($data as $item => $key)
  519. {
  520. $data[$item]['date']=$date;
  521. $form=$key['form'];
  522. $form=unserialize($form);
  523. $data[$item]['male']=$form['gender']['male'];
  524. $data[$item]['female']=$form['gender']['female'];
  525. }
  526. $this->modSmartyAssign('data',$data);
  527. unset($data);
  528. $this->modSmartyAssign('dateformat',DATE_TIME_FORMAT);
  529. $text=$this->modSmartyFetch("admin/showforms.tpl");
  530. }
  531.  
  532. if($_GET['showforms']>0)
  533. {
  534. $fid=$_GET['showforms'];
  535. $rpp=$this->config['Users shown per page'];
  536. $page=$_GET['page'];
  537. if(!$page) $page=1;
  538. $begin=($page-1)*$rpp;
  539. $end=$rpp*$page-1;
  540. $start=($page-1)*$rpp;
  541.  
  542. $data =& $this->modGetAll($this->lang_autogenprofile_table,array('fid'=>$fid),"",1,$start,$rpp);
  543. $count=$this->modGetOne($this->lang_autogenprofile_table,array('fid'=>$fid),"count(*)");
  544. $countries =& $this->modGetAllCountries();
  545. foreach ($countries as $item)
  546. $country[$item['code']]=$item['name'];
  547. $form =$this->modGetRow($this->lang_autogenprofile_forms_table,array('id'=>$fid));
  548. $date=date("Y-m-d H:i:s",$form['ts']);
  549. $form=unserialize($form['form']);
  550. foreach ($data as $item => $key)
  551. {
  552. $user=$this->modGetAllUsers(array('username'=>$key['username']));
  553. $user=$user[0];
  554. $data[$item]['gender']=$user['gender'];
  555. $data[$item]['country']=$country[$user['country']];
  556. $data[$item]['birth_date']=$user['birth_date'];
  557. $data[$item]['id']=$user['id'];
  558. $data[$item]['fullname']=$user['lastname']." ".$user['firstname'];
  559. }
  560.  
  561. if($page!=1) $yprev=1; else $yprev=0;
  562. $lastpage=(int)($count/$rpp)+1;
  563. if($count%$rpp==0) $lastpage--;
  564. if($page!=$lastpage) $ynext=1; else $ynext=0;
  565.  
  566. $this->modSmartyAssign('data',$data);
  567. $this->modSmartyAssign('total',count($data));
  568. unset($data);
  569. $this->modSmartyAssign('date',$date);
  570. $this->modSmartyAssign('start',$start);
  571. $this->modSmartyAssign('previous',"plugin.php?plugin={$this->plugin_class_name}&amp;showforms=$fid&amp;page=".($page-1));
  572. $this->modSmartyAssign('next',"plugin.php?plugin={$this->plugin_class_name}&amp;showforms=$fid&amp;page=".($page+1));
  573. $this->modSmartyAssign('form',$form);
  574. unset($form);
  575. $this->modSmartyAssign('ynext',$ynext);
  576. $this->modSmartyAssign('yprev',$yprev);
  577. $this->modSmartyAssign('dateformat',DATE_FORMAT);
  578. $text=$this->modSmartyFetch("admin/showusers.tpl");
  579. }
  580.  
  581. if(!$text) {
  582. $this->modSmartyAssign("country",$countries);
  583. $text =$this->modSmartyFetch("admin/autogenprofile.tpl");
  584. }
  585. return $text;
  586. }
  587.  
  588. }
  589.  
  590. ?>
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 95
Reputation: flynismo is an unknown quantity at this point 
Solved Threads: 1
flynismo flynismo is offline Offline
Junior Poster in Training

Re: Problem with auto profile generator

 
0
  #4
Oct 12th, 2008
Or you can download the code below in zip format if it makes it easier for you....thank you.
Last edited by flynismo; Oct 12th, 2008 at 6:58 pm.
Attached Files
File Type: zip autogenprofile.zip (4.8 KB, 0 views)
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 848
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 68
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Problem with auto profile generator

 
0
  #5
Oct 12th, 2008
Originally Posted by flynismo View Post
Also, my knowledge of php is very limited...this would otherwise be a very simple problem to resolve (the problem with the code is that it is not getting the state out of the database, just the city...but I don't know how to enter the code properly)
Its obvious from the code, (or lack there of) that you are in way over your head. This looks like a form validation class that extends another class and what you would have to do is create your own class which would probably extend this one to create your own functionality. This forum is for developers to get and offer help to other developers. I'm not saying this to be rude, I just don't want you to waste any more of your time. I just don't know of any developer here at Daniweb or any other forum that will be willing to do this for you for free. There is another forum at Daniweb for finding a developer here which is probably more along the lines of what you are looking for.

Now if you want to try to make this adjustment yourself and have specific questions about different aspects of PHP I would love to help you.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 95
Reputation: flynismo is an unknown quantity at this point 
Solved Threads: 1
flynismo flynismo is offline Offline
Junior Poster in Training

Re: Problem with auto profile generator

 
0
  #6
Oct 12th, 2008
Originally Posted by R0bb0b View Post
Its obvious from the code, (or lack there of) that you are in way over your head. This looks like a form validation class that extends another class and what you would have to do is create your own class which would probably extend this one to create your own functionality. This forum is for developers to get and offer help to other developers. I'm not saying this to be rude, I just don't want you to waste any more of your time. I just don't know of any developer here at Daniweb or any other forum that will be willing to do this for you for free. There is another forum at Daniweb for finding a developer here which is probably more along the lines of what you are looking for.

Now if you want to try to make this adjustment yourself and have specific questions about different aspects of PHP I would love to help you.

That's ok, I understand...I thought it would simply be a matter of inserting a few lines of code-didn't realize it would be this detailed.
I would love to do this myself, but as you said, I know I'm in way over my head.

Just a thought; if I created a few profiles with the profile generator, would there be a relatively quick way to manually edit the profiles (maybe through phpMyAdmin or something?)
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 848
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 68
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Problem with auto profile generator

 
0
  #7
Oct 13th, 2008
When viewing a table in php myadmin there is a button on the top that says browse which will allow you to view the data in the table and each row has an option to edit.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 95
Reputation: flynismo is an unknown quantity at this point 
Solved Threads: 1
flynismo flynismo is offline Offline
Junior Poster in Training

Re: Problem with auto profile generator

 
0
  #8
Oct 13th, 2008
I really, really don't want to sound like I'm being lazy, but I tried doing it that way before, but it takes too long doing it that way...
Basically, what the deal is is that I'm starting a dating site, and I'm afraid that no one who visits the site will join if they see that no one is on the site. Since most people will only be interested in meeting people within x-amount of miles, I figure that I would need roughly 1,000 people per state so that there's at least a few members of each gender within reasonable range of random visitors to the site; and as members join I would remove the dummy profiles. Honestly, I hate the idea of even having dummy profiles, but it seems to be the best alternative for my situation. But anyway, I want to make ~50,000 dummy profiles, and manually editing each one in the database would take forever (took me about an hour to do 250).
Looks like the only way to do this is to get the profile generator functioning properly...but thanks for your help!
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 848
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 68
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Problem with auto profile generator

 
0
  #9
Oct 13th, 2008
Originally Posted by flynismo View Post
I really, really don't want to sound like I'm being lazy, but I tried doing it that way before, but it takes too long doing it that way...
Basically, what the deal is is that I'm starting a dating site, and I'm afraid that no one who visits the site will join if they see that no one is on the site. Since most people will only be interested in meeting people within x-amount of miles, I figure that I would need roughly 1,000 people per state so that there's at least a few members of each gender within reasonable range of random visitors to the site; and as members join I would remove the dummy profiles. Honestly, I hate the idea of even having dummy profiles, but it seems to be the best alternative for my situation. But anyway, I want to make ~50,000 dummy profiles, and manually editing each one in the database would take forever (took me about an hour to do 250).
Looks like the only way to do this is to get the profile generator functioning properly...but thanks for your help!
Then you have two options.
1. Spend the time that it takes to learn php, we will be happy to help you on your way. PHP.net has a huge resource of documentation and examples available. There is actually more online documentation for php than any other language, except maybe javascript, but I doubt it.

2. Find a freelancer which is not hard to do seeing there are many forums available and ask for a price quote. Give them everything, not just the little piece that you gave me and ask them how long and how much. You can even get multiple opinions.
Last edited by R0bb0b; Oct 13th, 2008 at 12:10 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 95
Reputation: flynismo is an unknown quantity at this point 
Solved Threads: 1
flynismo flynismo is offline Offline
Junior Poster in Training

Re: Problem with auto profile generator

 
0
  #10
Oct 14th, 2008
Going with option 1...started taking the tutorials at w3 a few weeks ago. Probably sounds weird but I'm actually enjoying learning php. It sounds so simple in theory, but in practice php has been pretty tough. Right now I just know the very basics. But I'll definitely be back with questions as I go along.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 986 | Replies: 9
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC