Jump to content

carlosx2

Members
  • Posts

    42
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

carlosx2's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, I have the following problem. I am trying to automate the process of installing a control panel like zpanel. I have already done this with vestacp and it installs perfectly but i have one problem and that is that i need to out put when it is completed with installing. The problem is that i need php to wait to execute the last line till the the rest has been executed. Let me show you my code tha tis installing the control panel on the remote server. elseif ($softname == 'zpanel') { $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); //$ssh->write("yum update -y\n"); //$ssh->setTimeout(20); //$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("yum install mc nano screen wget -y\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("screen\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("wget https://raw.github.com/zpanel/installers/master/install/CentOS-6_4/10_1_1.sh\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("chmod +x 10_1_1.sh\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("./10_1_1.sh\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("y\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("8\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("34\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("1\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write(" \n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write(" \n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("y\n"); $ssh->setTimeout(5); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("n\n"); $ssh->setTimeout(250); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX); $ssh->write("cat /root/passwords.txt\n"); $ssh->setTimeout(20); $zpanelpass= $ssh->read('/.*@.*[$|#]|.*[P|p]assword.*/', NET_SSH2_READ_REGEX); $zpanelpasses = (explode(":",$zpanelpass)); $ssh->write("reboot\n"); mysql_query ("INSERT INTO bloksinstalls (userid, bl_id, name, paths, version, uniid, mysqlpass, mysqluser) VALUES ('$bl_userid','$bl_productid', '$softname', '$paths', '$version', '$uniid', '$zpanelpasses[3]', 'root')"); echo "<div class='col-lg-12 text-center'> <h4 class='success-header'>Copy the following information to a safe place.</h4> </div> <div class='col-md-12 text-center success-subheader text-primary'>To login into your control panel use the following user and password:</div> <div class='col-md-6 text-right success-login'> Username: <strong class='text-success'>zadmin</strong><br></div> <div class='col-md-6 text-left success-login'> Password: <strong class='text-success'>". $zpanelpasses[1]."</strong><br></div> <div class='col-md-12 text-center success-tlink text-primary'>Click the link to access your control panel:</div> <div class='col-md-12 text-center success-link'><a class='text-success' href='https://". $ip."' target='blank'>https://". $ip."</a> <i class='text-success fa fa-arrow-circle-right'></i></div> "; } So as you can see i try to use settimeout, but i also have tried to use sleep to control when the script continues with the rest of the script. But when i see the timeout or sleep too high the ajax on the front keeps loading as it seems it is not getting any output in the data. As soon as ajax get the out it will start the success function(data). I am not sure i might have my problems in my ajax which look like this $(document).ready(function() { $('#eml').focus(); $('#instbtn').click(function() { var a = $('#eml').val(); var b = $('#pw').val(); $('.blinstbtn').fadeToggle(300); $('.insttext').fadeToggle(300); $('#loadingimage').show(); $('#loadtext').show(); $.ajax({ type:"POST", url: "templates/cloudblok/php/functions.php", data: {soft : soft, username: username , password: password, ip : ip, bl_productid: bl_productid, bl_userid: bl_userid, paths : paths, version : version, uniid : uniid,}, success: function(data) { $('#loadtext').hide(); $('#loadingimage').hide(); $('#compinfo').show(); $('#sshcall').html(data); }//END success_ajax1 }); //END ajax() #1 }); //END mybutt.click() }); //END $(document).ready() I also have tried to make a while and do while loop in my php page. The while loop will also for a certain file and only when it would turn out yes it would continue the code. Of course that didn't work. I am out of solutions here. Maybe some one can help me or point me in the right direction so i can get more control over the time of the execution of the script. thanks
  2. Ok so i am really stuck here. I am trying to determen how the variable $this is being set and where. I am modifying the com_content of joomla. Only the carticle and i would like to connect the article with K2 component. But to do this i need to load information from the joomla data base. so far i have gotten this far. I am adding this below the article text. I am getting the name of the article and set into a variable. I have no idea where $this is being loaded with the jos_article stuff but it does that. I need to find that page to understand how it is working. So i have gotten this far. <?php echo $this->article->text; $tests = $this->article->title; print_r ($tests); ?> Now i want to connect to the k2 table within the joomla database to search is the name of the article is also represented in the k2 table. If so it will out put a link to the k2 table if there is non it will out put nothing. My question is how do i connect to the k2 table when the $this variable is loaded with all the info from article content. I need to know how i can load a second variable that loads all the K2 table content. I have noticed that also in the K2 component $this is being set to get all the info. How hard is it to find this variable in the script pages. lol I hope i made it clear what i am looking for. thanks
  3. well that is what I had first just e Ho and no if. it have me the error. it has to be different. maybe it.is.the fact that. I have pop Iside a javazcript. but how would you write this in javascript. that's really not my thing. plus I load the glob function into a variable its not javascript.
  4. ok i have the following problem. I try to generate a play list with the variable $flv_video it stores all the flv movie i have gotten from a folder with glob. But this code i made is not generating a play list at all. How should i do this? I am also no pro at flowplayer. I need a play list in the player code, i know it is possible in flow player. I need it as not every folder has a set number of movies, it has to be dynamic. I am sure it has to be something like i did but it needs some help . <!-- Flowplayer installation and configuration --> <script language="JavaScript"> flowplayer("player", "http://fukvidz.com/content/player/flowplayer-3.2.1.swf", { // this will enable pseudostreaming support plugins: { pseudo: { url: 'http://fukvidz.com/content/player/flowplayer.pseudostreaming-3.2.1.swf' } }, controls: { playlist: true, // use tube skin with a different background color url: 'http://fukvidz.com/content/player/flowplayer.controls-3.2.0.swf', backgroundColor: '#aedaff' }, // clip properties playlist: [ // our clip uses pseudostreaming provider: 'pseudo', <?php foreach ($flv_video as $flv_file){ if { echo "{url: 'http://fukvidz.com/$flv_file', scaling: 'fit'},"; }} ?> } }); </script> <!-- END FLV MOVIE CONTAINER FOR THE PLAYER WHEN PEOPLE ARE LOGED IN ENDS HERE -->
  5. Well this is not really a glob issue. What i would like to do is write a little code that tells me if an mime type is there or not. at the moment i have if ($flv_movie_count >= 3){ ?> this little if check how many files there are in the folder. I know that is there are more than 2 files it are flv files. But i would like to use a statement that checks if the the file is flv or not. Then run script or go to a else. I have looked around, but i just don't know which function i should be using and how to apply it. Maybe some one can help me. Thanks
  6. hi all , I am trying to recode the whole blog front page. What i would like to do is that i have like 15 articles show up as updates and then the rest of the articles below it. I just don't know how to tell them appart. How have they done this. I know some scripts say like list 1 to many or 1to 5 and then continue with 6 to many or something like this. But i have no idea how joomla does this and where to find this. I can also not see on this place where blog_item is being called in this script. <table class="blog<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" cellpadding="0" cellspacing="0"> <?php if ($this->params->def('show_description', 1) || $this->params->def('show_description_image', 1)) :?> <tr> <td valign="top"> <?php if ($this->params->get('show_description_image') && $this->section->image) : ?><img src="<?php echo $this->baseurl . '/' . $cparams->get('image_path') . '/'. $this->section->image;?>" align="<?php echo $this->section->image_position;?>" hspace="6" alt="" /><?php endif; ?> <?php if ($this->params->get('show_description') && $this->section->description) : ?> <?php echo $this->section->description; ?> <?php endif; ?><br /> <br /> </td> </tr> <?php endif; ?> <?php if ($this->params->def('num_leading_articles', 1)) : ?> <tr> <td valign="top"> <?php for ($i = $this->pagination->limitstart; $i < ($this->pagination->limitstart + $this->params->get('num_leading_articles')); $i++) : ?> <?php if ($i >= $this->total) : break; endif; ?> <div> <?php $this->item =& $this->getItem($i, $this->params); echo $this->loadTemplate('item'); ?></div> <?php endfor; ?></td> </tr> <?php else : $i = $this->pagination->limitstart; endif; ?> <?php $startIntroArticles = $this->pagination->limitstart + $this->params->get('num_leading_articles'); $numIntroArticles = $startIntroArticles + $this->params->get('num_intro_articles', 4); if (($numIntroArticles != $startIntroArticles) && ($i < $this->total)) : ?> <tr> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <?php $divider = ''; if ($this->params->def('multi_column_order', 0)) : // order across, like front page for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) : if ($z > 0) : $divider = " column_separator"; endif; ?> <?php $rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); $cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns')); ?> <td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>"> <?php $loop = (($z < $cols)?1:0) + $rows; for ($y = 0; $y < $loop; $y ++) : $target = $i + ($y * $this->params->get('num_columns')) + $z; if ($target < $this->total && $target < ($numIntroArticles)) : $this->item =& $this->getItem($target, $this->params); echo $this->loadTemplate('item'); endif; endfor; ?></td> <?php endfor; $i = $i + $this->params->get('num_intro_articles', 4) ; else : // otherwise, order down, same as before (default behaviour) for ($z = 0; $z < $this->params->get('num_columns'); $z ++) : if ($z > 0) : $divider = " column_separator"; endif; ?> <td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>"> <?php for ($y = 0; $y < ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); $y ++) : if ($i < $this->total && $i < ($numIntroArticles)) : $this->item =& $this->getItem($i, $this->params); echo $this->loadTemplate('item'); $i ++; endif; endfor; ?></td> <?php endfor; endif; ?> </tr> </table> </td> </tr> <?php endif; ?> <?php if ($this->params->def('num_links', 4) && ($i < $this->total)) : ?> <tr> <td valign="top"> <div class="blog_more<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php $this->links = array_splice($this->items, $i - $this->pagination->limitstart); echo $this->loadTemplate('links'); ?></div> </td> </tr> <?php endif; ?> <?php if ($this->params->def('show_pagination', 2)) : ?> <tr> <td valign="top" align="center"> <?php echo $this->pagination->getPagesLinks(); ?><br /><br /> </td> </tr> <?php endif; ?> <?php if ($this->params->def('show_pagination_results', 1)) : ?> <tr> <td valign="top" align="center"> <?php echo $this->pagination->getPagesCounter(); ?></td> </tr> <?php endif; ?> </table> that is part of the blog.php of joomla 1.5. Maybe some can point me in the right direction on how they put this together. How they call content, determent when it should show up. I know all the info is in the database but how do they call it etc. Hope some one can shine some light on my issue.
  7. ok i get it. the only weird thing is that in the text i tried to enter there weren't any of these ' or anything else. just .... thats all. but i understand i should do it for each string
  8. ok it worked by just adding $story = mysql_real_escape_string($story); but i have to find out how and why it worked this way. so next time i know how to use it and why. so i need to teach myself this little piece of code. thanks for the help. this place is really great.
  9. well this is all coming from a form to submit all this data. i fill in the form hit submit and you are done. its is about $story yes. so i use the post action that bring it to this site to process it the database. where do i enter that one line. ? before i run the sent to code?
  10. Do you even read threads before you post? not all of it no, original poster , you may have a slashing problem wich is killing it, you need to add slashes oi recon (maybe), isue is with single quotes, hyphens i am not sure what you mean by you may have a slashing problem
  11. could it be possible that my php ini is keeping me from posting so many char, would be possible. i already looked at my php ini but i can't find anything that would keep me from sending that many char to my db. also i am not sure where to look
  12. this is the code i am using to post to the sql database <title>Done</title><?PHP $user_name = ""; $password = ""; $database = ""; $server = ""; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); $testname = $_POST[title]; $query = "SELECT * FROM dvd WHERE title='$_POST[title]'"; $result = mysql_query($query); $num = mysql_num_rows($result); if ($num == 0) { $SQL = "INSERT INTO dvd (title, date, time, models , niche , models2 , models3 , models4 , models5 , models6 , models7 , models8 , story ) VALUES ('$title' , '$date' , '$time' , '$models' , '$niche' , '$models2' , '$models3' , '$models4' , '$models5' , '$models6' , '$models7' , '$models8' , '$story')"; $result = mysql_query($SQL); mysql_close($db_handle); print "DVD has been added to the database. <p> <a href='dvdcreator.php'>Add another DVD</a>"; print_r ($SQL); } else { print "DVD has already been entert into the database. hit the back button</a>"; mysql_close($db_handle); } ?> it still not working. checked with my wp blog that also uses the same mysql and there its working. so i think it might be the code or something. Then again when i so not that many char its all working perfect.
  13. i am using phpMyAdmin - 2.11.9.5 * MySQL client version: 5.1.30 data type i am using is text, in mysql that is.
  14. I have a problem it seems with sending over long pieces of text to mysql. i have a form with a story that is being send to a registration file in php. All is fine even when i i put the var by print_r i see the long piece of text wich is about 564 thats not that many. I have a table in mysql setup with a text row to hold this story but for some reason its only stores my text when i submit around 189 I don't get what i am doing wrong. Its is just not accepting more. did i forget a certain setting or something?
×
×
  • 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.