Jump to content

released

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

released's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I would like to create an auto-install script that allows users to automatically upload my product to their host. I have created a pseudo-script as a logical reference for what I am trying to accomplish, but I am not sure of the correct methods to use. Basically I will have a form where the user can enter his domain, username and password so the script can login as a root user to the site. Then, I would like to create the appropriate directories, then upload the files, then create the database, and run a database setup script. Here is the logical pseudo-script: <? //Variables $domain= ""; $user= ""; $pass= ""; $databaseName= ""; $databaseUser= ""; $databasePass= ""; $rootFolder= ""; //File Array $fileArray= array(); $fileArray[0]= ""; $fileArray[1]= ""; $fileArray[2]= ""; $fileArray[3]= ""; $fileArray[4]= ""; $fileArray[5]= ""; $fileArray[6]= ""; //Host Connect host_connect($domain, $user, $pass); //Create Directories $mp3s= mkdir($rootFolder."/MP3s"); $images= mkdir($rootFolder."/Images"); $downloads= mkdir($rootFolder."/Downloads"); //Upload Files for($i=0; $i< count($fileArray); $i++){ file_put_contents($fileArray[$i], $path); }; //Create Database mysql_create_database($databaseName, $databaseUser, $databasePass); //Setup Database $dbSetup= file_open($rootFolder."/databaseSetup.php"); if($dbSetup= true){ echo "Setup Complete"; $deleteSetup= delete_file($rootFolder."/databaseSetup.php"); }else{ echo "Database Setup Error"; }; ?> Also, is there anything I should know about running scripts like this? How do I end the session logged in as the root user of their domain? Help is greatly appreciated, Jesse
  2. I am developing a quick and easy mailing list emailer. Basically, I am posting the "From", "Subject" and "Message" variables from Flash, and querying MySQL for each of the emails, and setting the mail function on a loop like the following code; $from= $_POST['from']; $subject= $_POST['subject']; $body= $_POST['body']; $header= "From: ".$from; $query= "SELECT * FROM `mailing`"; $data= mysql_query($query); while($row= mysql_fetch_array($data)){ $to= $row['email']; mail($to, $subject, $body, $header); }; However, I will get multiple emails on the same account, and only one will contain the correct information. Also, I want to make sure that the loop doesn't stop if I get to an email that doesn't work anymore. Help will be greatly appreciated.
  3. Thanks for the response, the readfile(); method did the trick, except for when I use it from flash. This is the example: // Posted From Flash $user= $_POST['user']; $pass= $_POST['pass']; $number= $_POST['number']; // Path/Password Query $storeQuery= "SELECT * FROM `store`WHERE `number`= '".$number."'"; $storeData= mysql_query($storeQuery); while($storeRow= mysql_fetch_array($storeData)){             $path= $storeRow['path']; $password= $storeRow['pass']; } // Order Query $ordersQuery= "SELECT * FROM `orders` WHERE `custEmail` = '".$user."'AND `itemNumber`= '".$number."'"; $ordersData= mysql_query($ordersQuery); while($ordersRow= mysql_fetch_array($ordersData)){ $itemNumber= $ordersRow['itemNumber']; $orderStatus= $ordersRow['orderStatus']; }; // Verification if($itemNumber== $number && $password== $pass && $orderStatus== "Completed"){ $status= "Success"; echo "&"."downloadStatus=".$status; readfile($path); } else { $status= "Failure"; echo "&"."downloadStatus=".$status; } Basically I am retrieving the user's username and password, and item number from flash. With the item number, I query the `store` table and retrieve the filepath and the correct password. Then I query the `orders` table to verify that there is a completed order containing both the user's email AND the item number posted from flash. I then use an "if" statement to check that; 1. The username is correct, 2. The password is correct and 3. The order is complete. If so I wish to execute the download. I get to the point where the status == "Success", but the file download does not begin. However, if I create a new php file with just readfile($path); it works correctly. Is there something I am missing? Also, is this a safe way to execute downloads?
  4. I have a dynamic site that has a paypal store. When a customer purchases a download, the email used for the purchase is used as a username, and I send them an email with the password to the download. The item number is sent to MySQL and I retrieve the password and filepath of the download. If the payment status is "Completed" and the username and password are correct, I wish to initiate the download. However, I am not sure how to initiate this. The downloads will most likely be a .zip file. I keep all downloads in a certain directory, but I do not want the download path to be visible when the download is initiated to prevent unauthorized downloads. What is the easiest way I can accomplish this?
  5. I am in the final stages of a project I have been working on for about 6 months. It is just a basic dynamic website where the user can login and edit the website. I am using Flash, PHP and MySQL. The problem that I have faced is that when I add or delete and entry, the auto_incremented `id` field may cause the entry to be out of order. When I add an entry, it will add it in the middle or beginning of the table. The result is a non-ascending set of values for `id`, when I need the entries to be in order. My scripts are as follows: // Select $id= $_POST['id']; //Retrieved from Flash $limit= $_POST['limit']; //Retrieved from Flash $query= "SELECT * FROM `news` LIMIT ".$id.",".$limit."; $data= mysql_query($query); //How can I incorpatate an efficient 'SORT BY' function to automatically sort the `id` field every time I retrieve an entry? Or is there a way that I can set the `id` field to automatically do this, such as making it a Primary, Index or Unique? //Insert $date= $_POST['date']; $entry= $_POST['entry']; $query= "INSERT INTO `news` (`id`, `date`, `entry`) VALUES ('', '$date', '$entry'); mysql_query($query); //Is there a way that I can automatically add an entry to the end of the table with the auto-incremented value? //Delete $id= $_POST['id']; $query= "DELETE FROM `news` WHERE `id`= ".$id; mysql_query($query); //When I delete an entry, is there a way that I can have all the entries that come after the row being deleted automatically reset their numbers to adjust to the missing id number? So if I delete entry '7', entry '8' will become entry 7, and entry '9' will become 8 and so on and so forth? Thanks Very Much for your time, Jesse
  6. I have been online reading tutorials for a long time for MySQL, and tried numerous things, but it stills seems that I can't get MySQL to work. I don't think it has anything to do with the scripts, I think it may have more to do with my configuration, I have downloaded many tutorials that I tried as is and they don't work. I don't know if I have to set file permissions or something like that, I am running Apache on my computer, I installed phpmyadmin, php and apache with FoxServ, I don't know if there is a problem with that. Also, when I log into phpmyadmin, i have to use "root" without a password. I really don't know what the problem is, I understand the concepts and I've tried so many different things, but I am yet to successfully execute a MySQL query with php.
  7. I am going to be selling web templates on the net soon, but I am trying to figure out how I can automate the process with paypal. Basically, after the customer purchases the site, I want to send them an email with a link and user/password where their website is parked for them to download the file. I think I need to store a unique ID for each site, with a username, password, and URL where they can download the file. When they purchase the site I transfer the ID variable from paypal to the email autoresponder with the user/pass/url variables. They click on the link, enter in the password and username and download the file and I am done. However, I am not quite sure how this works or how Paypal works and how to pass the variables. I think I should set the Auto-Return page to my php script, which will receive the ID variable from Paypal, then retrieve the rest of the information from MySQL. That's all good but I am not sure how to get the info from Paypal. Does anyone know how to help me?
  8. I have been trying for a while now to get a basic script to work between PHP and MySQL. I have read almost an entire 700 page book on the topic and countless online tutorials, understand the concepts but I am clearly doing something wrong. I am not sure if it is in the scripting or it is some other stupid problem. I recently installed FoxServ on my computer, which includes Apache, PHP and MySQL. The server works, and when I browse to localhost the default FoxServ page comes up. I drag the "connect.php" code to the "www" folder where the default apache site is. I then type [a href=\"http://localhost/connect.php\" target=\"_blank\"]http://localhost/connect.php[/a] to go to the page. It loads but I don't get any info from the MySQL database. The code is something like this: <? $connect= mysql_connect("localhost", "root", ""); //I have been using the root user $db= mysql_select_db("myDatabase"); $query= "SELECT * FROM mp3"; $result= mysql_query($db, $query); while($myrow= mysql_fetch_array($result)){ echo $myrow[mp3Title]; } ?> It's very simple, and I've tried many variations, but I can't seem to get any info in or out of the database, and it's really holding me back. Help would be greatly appreciated.
×
×
  • 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.