Jump to content

unidox

Members
  • Posts

    557
  • Joined

  • Last visited

    Never

Everything posted by unidox

  1. unidox

    SSH

    idk, its always worked for me. What I am trying to do is: 1- Create a screen session named server 2- Change directory to scripts dir 3- Run Script The need for a screen is important, so that I can kill the screen which kills the script if I need to. Any ideas?
  2. unidox

    SSH

    I am making an ssh connection with this script: <?php if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist"); // log in at server1.example.com on port 22 if(!($con = ssh2_connect("server.server.com", 22))){ echo "fail: unable to establish connection\n"; } else { // try to authenticate with username root, password secretpassword if(!ssh2_auth_password($con, "root", "password")) { echo "fail: unable to authenticate\n"; } else { // allright, we're in! echo "okay: logged in...\n"; // execute a command if(!($stream = ssh2_exec($con, "screen -list" )) ){ echo "fail: unable to execute command\n"; } else{ // collect returning data from command stream_set_blocking( $stream, true ); $data = ""; while( $buf = fread($stream,4096) ){ $data .= "<br />" . $buf; } echo $data; fclose($stream); } } } ?> That code works, however, I am trying to kill a screen "screen -X -S server kill" which kills the server screen session, and then I am trying to create another screen "screen -S server", which creates the server session for screen. However, I was trying to add a command to change directory and run a script "cd /home/ | script", but that command doesnt run. THis is the whole command: screen -X -S server kill | screen -S server | cd /home/ | script It kills and creates the screen, however it never changes directory or starts the script. What am I doing wrong?
  3. I was wondering how I create a dynamic paypal subscription. I have a database that include the paypal email, price, subscription term (monthly, yearly, ect). I cant figure out how to create a button where it creates a subscription so people can order a service from my site. Thanks for any help
  4. I am trying to use if preg_match but I am not to good at regex. I was wondering how I can do this: I have a form and the name of an input is username_required, I am trying to check to see if _required is in the name. How do I do that? Thanks
  5. Wow, can we get on the subject? What websites do you recommend to monitor my sites.
  6. I run a web hosting site... Anyone know of some good website monitoring sites that print charts and stuff, so I can add all my clients to it and get alerts via email and sms when their sites go down?
  7. I am trying to check to see is in the right format when a user registers, I have this code: if (preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $email)) { return true; } But it never works, whats wrong?
  8. I have this domain: http://daskeet.com/, and I am trying to have it remotely connect to a sql db on the deviantgaming.net server. I have this code: <?php mysql_connect("deviantgaming.net", "username", "password") or die(mysql_error()); mysql_select_db("table") or die(mysql_error()); ?> But I am getting the error: Can't connect to MySQL server on 'deviantgaming.net' (10060) On cpanel for deviantgaming.net I added both the domain and domain ip to the remote sql allowable ips. Any ideas?
  9. unidox

    DB

    I have a db class, it includes functions like connecting to the database, selecting the table, querying, inserting, ect. I was wondering how do I include that class in each of the classes I create like login classes and such.
  10. I am getting this error: Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. Here is my login code: $q = mysql_query("SELECT * FROM `pcp_users` WHERE `username` = '$username' AND `password` = '$password' LIMIT 1"); if (mysql_num_rows($q) > 0) { $name = $r['name']; $level = $r['level']; $date = "" . date('l dS \of F Y h:i:s A') . " EST"; $_SESSION['name'] = $name; $_SESSION['username'] = $username; $_SESSION['level'] = $level; mysql_query("UPDATE `pcp_users` SET `date` = '$date' WHERE `password` = '$password' AND `username` = '$username'"); header("Location: index.php?p=user_home"); exit(); } else { $error = "Incorrect username/password. Please try again!"; } that code is included inside index.php which contains ob_start/flush. I get that error every time I login, but if I refresh the page, the error goes away. Any suggestions?
  11. <?php //title echo "<br>\n<h2><font color='#A5B9D5'>TRAINING SQUADRONS</font></h2>\n"; //get characters by squadron $sql = "SELECT id, squadronDB, codename FROM cerebra ORDER BY squadronDB"; $result = mysql_query($sql) or trigger_error(mysql_error,E_USER_ERROR); while($row = mysql_fetch_assoc($result)){ //here's the key. Use a while loop to repeat through the code $thisID = $codename["id"]; $squadronDB = getSquad($thisID); $squadronDB = getChar($char_ID); switch ($i) { case "1": echo "i is Alpha"; break; case "2": echo "i is Alpha"; break; case "3": echo "i is Alpha"; break; case "4": echo "i is Alpha"; break; // start character div echo '<div style="float: left; padding-top: 5; width: 220;">'; echo "<span class='fineprint'>"; // makes thin bar echo '<hr align="centered" color="#050F1D" size="2" width="66%">'; // image div echo '<div style="float: left; padding-left: 5;"><img src="/cerebra/images/'.$row['id'].'-.jpg" width="60" height="75" border="2px" bordercolor="#415582"></div>'; // name div // styles echo '<div style="float: left; vertical-align: top; padding-left: 5;"><p>'; // span and model name echo '<span class="fineprint"><i>'.$row['squadronDB']; // link and codename echo ' <br>as <a href="/cerebra/display.php?id='.$row['id'].'">'.$row['codename'].'</a></i></span></p></div>'; // end character div echo '</div>'; //these two lines (or any lines up to the closing brace) will be repeated for each row returned by the query } } // You forgot to close your while. ?>
  12. unidox

    Hover

    I have a function that changes a div when an image gets hovered over. The only problem is, I am trying to add an image. Its not working at all, any suggestions? Function: function swapOnRoster(first_name,last_name,handle,pos,country) { var rosterHandle = document.getElementById('rosterHandle_'+pos); rosterHandle.innerHTML = country+first_name+' “'+handle+'” '+last_name; } PHP: echo "<a href=\"index.php?p=roster&id=" . $r4['user_id'] . "\" onmouseover=\"swapOnRoster('" . $name[0] . "','" . $name[1] . "','" . $r4['display'] . "', '" . $pos . "', '<img src='images/flags/" . $country . "/" . spaces($r4['country']) . ".png' alt='' /> ')\" onmouseout=\"swapOffRoster('" . $pos . "');\"><img src=\"" . $pic . "\" width=\"50\" height=\"50\" border=\"\" alt=\"\" /></a>"; $country gets the first letter of the country, $name is an array for the first/last name, $r4['display'] gets the display name, $pos gets left/right. Just wondering how I can fix this.
  13. if (($var2 == 2 OR $var == 3) OR ($var == 2 AND $var == 3)) { }
  14. unidox

    Function

    Ok, I have a dropdown like this: <select name="name"> <option value="John"> </select> but I have over 400 options from the drop down. I was wondering if there was a way I can make it selected if the user already selected it. Because lets say I add a user, it adds the name John in the db. When I want to edit the user, I dont want to sort through all the names, I am trying to have it selected if the value matches the database. How can I do that? Thanks
  15. I was wondering how I can do this: I have alot of options inside a select, and I need to have the values like: <option <? if($r['name'] == option value) { echo "selected = selected"; } ?> value = "John"> but the problem is, how can I find the value without typing the name in for each option. Thanks
  16. No, I have a form like: <select name="names" multiple="multiple"> <option value="junk">Junk</option> <option value="trunk">Trunk</option> </select> If the user selects both values and then submits the form, how do I turn the values into an array than I can use foreach.
  17. I have a select form that allows you to select multiple values, I was wondering how I would in php turn all of them into an array, and then I can use a foreach. Thanks
  18. unidox

    Php country

    No, I am saying a user registers, selects their country from a dropdown. When another user visits a profile page, it shows a flag from their country.
  19. unidox

    Php country

    I was just wondering if anyone knows a script that I can have a country dropdown, and it inserts it into the db and shows a small flag for each country. Thanks
  20. unidox

    Replace

    Well, this cant be done manually due to its a dynamic site. All I am trying to do is replace & with & inside the html of my site.
  21. unidox

    Replace

    I tried this: <script language="Javascript" type="text/javascript"> document.prototype.htmlEntities = function () { return this.replace(/&/g,'&'); }; </script> and then in body I did this: <body onload="htmlEntities()"> But it doesnt work. Any ideas?
  22. unidox

    Replace

    I was wondering if there was a function I can put in the head of my website, that replaces all the & with & and all the other xhtml fixes. Thanks
  23. I tried this: function amp($content) { $content = preg_replace("/\s&&\s/", "AND", $content); $content = preg_replace("@(.+)&(.+)@", "&", $content); return $content; } but it still wont replace the & with &. Whats wrong?
  24. Well all I am trying to do is replace & with &. The problem is, in php code I use && for AND in both sql and if statements. Can I work around this?
×
×
  • 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.