Jump to content

m u r

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

m u r's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This piece of php script used to display a stock quote worked beautifully up until a couple weeks ago. I can't figure out why seeing as the yahoo url still downloads the information. Any ideas? <?php $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, 'http://quote.yahoo.com/d/quotes.csv?s=AAPL&f=sl1d1t1c1ohgv&e=.csv' ); curl_setopt( $ch, CURLOPT_HEADER, false ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $output = curl_exec( $ch ); curl_close( $ch ); $contents = explode( ',', str_replace( '"', '', $output ) ); echo "<p>AAPL stock: <b>\$$contents[1]</b> ( $contents[4] )</p>"; ?>
  2. Thanks Chigley, but it didn't work. Now I get the following at the top of the page when I visit it in a browser: Notice: Undefined index: name in /var/www/archutah/mail/signUp/index.php on line 3 Notice: Undefined index: username in /var/www/archutah/mail/signUp/index.php on line 3 Notice: Undefined index: password in /var/www/archutah/mail/signUp/index.php on line 3 and it's still blank as soon as I hit the submit button. Again, it's worked on several other computers, but I just get a blank screen.
  3. I tested this php form, and it worked on 2 out of three computers, all of which were on different networks. The one that didn't work stalled after I hit submit . . . all I got was a blank page . . . no error messages or anything. This happened whether it was on a PC or Mac, in Firefox, or IE. Any ideas what could be causing it? Thanks. <?php $domainname = "mydomain.com"; /* * Change this to your own domain **/ $adminmail = "info@mydomain.com"; /** Change this to your own email address **/ $webmail = "https://mydomain.com/mail/"; /** Change this to your own webmail url **/ $scriptlocation = "/home/ecreate"; /** Change this to point to your script **/ $name = escapeshellcmd($_REQUEST['name']); $username = escapeshellarg(escapeshellcmd($_REQUEST['username'])); $password = escapeshellarg(escapeshellcmd($_REQUEST['password'])); if (!isset($_REQUEST['name'])) { ?> <html> <head> <title></title> </head> <body> <form method="post" action="index2.php"> Full Name: <input type="text" name="name" /> <br> Username: <input type="text" name="username" /> <br> Password: <input type="password" name="password" /> <input type="submit" /> </form> </body> </html> <?php } elseif (empty($name) || empty($username) || empty($password)) { ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> You have left one of the information fields blank. Please press "back" on your browser and try again. </body> </html> <?php } $reply = exec ("sudo $scriptlocation $name $username $password"); switch ($reply) { case "success": ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Success:<br> </div> Congratulations, <?php echo $name ?>, you have successfully created an email account at <?php echo $domainname ?> with username <?php echo $username ?>. You may access your webmail account from anywhere by going to <a href=<?php echo $webmail ?>><?php echo $webmail ?></a> and signing in. </body> </html> <?php; $date = date('l dS \of F Y h:i A'); $subject = "Email User $name added to $domainname"; $body = "Email User was added on $date with a username of $username"; $headers = "From: root" . "\r\n" . "Reply-To: root@$domainname"; mail($adminmail,$subject,$body,$headers); break; case "error2": ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> You have used illegal characters in your first name. Please press "back" on your browser and try again. </body> </html> <?php; break; case "error3": ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> You have used illegal characters in your last name. Please press "back" on your browser and try again. </body> </html> <?php; break; case "error4": ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> You have used illegal characters in your username. Please press "back" on your browser and try again. </body> </html> <?php; break; case "error5": ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> You have used illegal characters in your password. Please press "back" on your browser and try again. </body> </html> <?php; break; case "error7": ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> The username you have selected is already in use. Please press "back" on your browser and try again. </body> </html> <?php; break; case ereg("^-bash: syntax error", $reply) ?> <html> <head></head> <body> <span style="color: rgb(204, 0, 0);">Error:<br> </div> Your input has caused an error. There might be a problem with your permissions. Please check your setup and try again. </body> </html> <?php; break; } ?> I am using it with the following script to create new users, though I don't think this is the problem: #!/bin/bash emailgroupfolder=/home/emailgroup ## the folder in which you want new emailaccount homes to be created emailgroupname=emailgroup ## the linux group to which your new email users will be assigned useraddpath=/usr/sbin/useradd ## the path to the command useradd on your system (it's probably the same) fname=$1 lname=$2 username=$3 password=$4 userlist=`cat /etc/passwd | cut -d: -f1 -s | grep $username` enc_password=`/usr/bin/htpasswd2 -nb $username $password | cut -f2 -d :` if [ $# -ne 4 ]; then echo "error6" ## There are more than or fewer than 4 arguments (Somebody has put down their middle name, or left off their last name) exit 1 fi if [ "$username" = "$userlist" ] ; then ## Username already exists on the system echo "error7" exit 7; fi case "$fname" in *[!a-zA-Z0-9]*) echo "error2"; exit 2;; ## First Name contains illegal characters *);; esac case "$lname" in *[!a-zA-Z0-9]*) echo "error3"; exit 3;; ## Last Name contains illegal characters *);; esac case "$username" in *[!a-zA-Z0-9]*) echo "error4"; exit 4;; ## Username contains illegal characters *);; esac case "$password" in *[!a-zA-Z0-9]*) echo "error5"; exit 5;; ## Password contains illegal characters *);; esac /usr/sbin/useradd -m -c "$fname $lname" -d $emailgroupfolder/$username -p $enc_password -s '/bin/false' -g $emailgroupname -G 8 $username echo "success" exit 0 fi
×
×
  • 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.