Jump to content

rizzler

New Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by rizzler

  1. I have this loop on a shorturl website i own that selects domains from my website and lists them in a dropdown list where users can select one domain to use as url shortener. The problem is that when a users selects and entry from the dropdown list this created only the [[[main_url]]] entry from the database table bellow can be used. When someone selectes "coolartistname.site.com the submit button cannot be pressed. in other words it's not adding the SELECTED attribute other than the [[[main_url]]] domain. Can anyone see on the code bellow why this would happen? When i echo $shortUrlDomains it's just saying "Array" and $_REQUEST['shortUrlDomain'] shows nothing. **Index.php** // get base urls $shortUrlDomains = getShortUrlDomains(); <?php foreach ($shortUrlDomains AS $k => $shortUrlDomain) { // active domains only if (($shortUrlDomain['premium_only'] !== '1') && ($shortUrlDomain['premium_only'] !== $Auth->id)) { continue; } echo '<option value="' . (int)$k . '"'; if (isset($_REQUEST['shortUrlDomain'])) { if ($k == (int)$_REQUEST['shortUrlDomain']) { echo 'SELECTED'; } } echo '>'; echo $shortUrlDomain['domain']; if ($disabled == true) { echo ' (' . safeOutputToScreen(t('unavailable', 'unavailable')) . ')'; } '</option>'; } echo '</optgroup>'; ?> FUNCTIONS.PHP function getShortUrlDomains() { // if we already have it cached if(defined('_SETTINGS_SHORT_URL_DOMAINS')) { return unserialize(_SETTINGS_SHORT_URL_DOMAINS); } // get connection $db = Database::getDatabase(true); // load from database $domains = $db->getRows("SELECT id, domain, premium_only, status FROM url_domain ORDER BY premium_only ASC, id ASC"); // organise and replace site url $rs = array(); foreach($domains AS $domain) { if($domain['domain'] == '[[[main_url]]]') { $domain['domain'] = _CONFIG_SITE_FULL_URL; } $rs[$domain{'id'}] = $domain; } **MYSQL DATABASE** url_domain (id, domain, premium_only, status, date_created, owner) VALUES (1, '[[[main_url]]]', 0, 'enabled', '2019-03-02 08:13:00', 1) (14, 'coolartistname.site.com', 6, 'enabled', '2020-04-18 19:21:59', 6);
  2. i just noticed that, thanks for the quick reply guys =) the main problem however is the one i just changedm y post above to, this one.
  3. the "if" statement wont work, if($r[0] + $_POST[kviga] < $r2[0]). i can change the less value to either a "<" or a ">" and the result will still be "cant do that". in my database the sum of "$query2" is 200, and the sum of "$query" is 55.
  4. Hello I wonder if someone please can help me get this to work? :/ <? //räknar ihop bokade kviga biljetter $query = "SELECT sum( kviga ) FROM `bokning`"; //kollar limit på kviga billjetter $query2 = "SELECT sum( kvigamax ) FROM `admin`"; $result = mysql_query($query) or die(mysql_error()); $result2 = mysql_query($query2) or die(mysql_error()); // Print out result of kviga while($r = mysql_fetch_row($result)) { echo $r[0]; } // Print out result of kvigamax while($r2 = mysql_fetch_row($result2)) { echo $r2[0]; } if($r[0] + $_POST[kviga] < $r2[0]) { $sql="INSERT INTO bokning (lagnamn, lagledare, kviga, kalv, ko, deltagare, ovrigt) VALUES ('$_POST[lagnamn]','$_POST[lagledare]','$_POST[kviga]','$_POST[kalv]','$_POST[ko]','$_POST[deltagare]','$_POST[ovrigt]')"; if (!mysql_query($sql,$db)) { die('Error: ' . mysql_error()); } echo "Bokningen är nu genomförd"; mysql_close($db) } else { echo "cant do that"; } ?>
  5. Hello. I am trying to make this shell script bellow work on my server wich should take the names in newacc.cvs and add them to the system. For each user the script should ask me to enter a password for the user im adding and then add them to the system, however my current solution do not work atm as when i run the script it dont stop to let me enter a password at all at the passwd echo, it just runs past it :/ do someone know how to make this work? using READ read -p "Enter your password" PASS echo $PASS" and the same thing happens Example from newacc.cvs maria;jones andreas;öring Script #!/bin/sh if [ "$#" == "0" ] then cat newacc.cvs | while IFS=';' read firstname surname; do useradd $firstname -m echo added $firstname to the system passwd $firstname cd /home/$firstname/ maildirmake.courier Maildir echo Maildir Created for $firstname done exit 0
  6. hello i have a script called "max.sh" with tars up the files of the user, now when im logged in as "max" i would like this script to be executed everytime i type "tar_files" or someting like that and it should not mather where on the computer i am at the moment. i understood i have to edit /home/max/.bash_profile to be able to achive this, but what to i write here to get this to work? i use latest debian by the way.
×
×
  • 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.