
DanC
Members-
Posts
21 -
Joined
-
Last visited
Never
Everything posted by DanC
-
Hi, Thanks for the quick reply. This is exactly what I was looking for. Thanks again!
-
Hi, Simple question. I have a column called "array" in my database, and inserted into each field is the following imploded array: mctriangle,570.65,355.1,1,1,0 It is an instance of an object. Each field in each row contains this information as an imploded array. [0] = Name [1] = X Axis [2] = Y Axis [3] = ScaleX [4] = ScaleY [5] = Rotation When extracted from the database, it is exploded back into the array above. As you can see, I would need to store a lot of rows for each object. Say we use 200 objects, thats 200 rows, which would be hard to search through. My question is: Could I store multiple imploded arrays inside 1 row only. E.g: mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0 The above would be 5 objects in one row of data, each imploded array separated by &&. How would I go about doing such a thing? Thanks!
-
Hi, I have an AS3 login script, but I want to work with PHP sessions. In AS3, how would I go about remotely executing a PHP script to create a session? I know about URLLoader but I've heard this only reads the text and doesn't execute it or something? Perhaps I am mistaken. Can someone guide me to creating a PHP session from clicking a button in AS3? Thanks, Dan.
-
Hi, I have created a system where a user has to login to view a swf file embedded on a php page. This php page cannot be accessed unless a session is registered. However, I want to stop them just going to: www.example.com/dir/flash.swf I want to prevent direct access to this file and only allow it to be seen when inside a php script. I guess I have to use .htaccess with some combined PHP'ing but i'm not sure how. Thanks.
-
Hi, I have this code in my script: $genno=rand(1,50000000000000); // Run some security checks for duplicate ids $genids=mysql_query("SELECT gen FROM info WHERE gen='$genno' "); $checkgenids=mysql_num_rows($genids); while ($checkgenids > 0) { $genno=rand(1,50000000000000); } // End the check $nameids=mysql_query("SELECT name FROM info WHERE name='$name' "); $checknameids=mysql_num_rows($nameids); if ($checknameids > 0) { die('<p><b><center><font color=red>Product name "'.$name.'" already exists!<hr></font></center></b></p>'); } mysql_query("INSERT INTO $maintab ($nametab, $linktab, $comptab) VALUES('$name', '$link', '$comp')") or die(mysql_error()); mysql_query("INSERT into $gcodetab ($codetab) VALUES ('$finalshuffle')") or die(mysql_error()); mysql_query("UPDATE $gcodetab SET gen='$genno' WHERE gen='0'") or die(mysql_error()); mysql_query("INSERT into download (id, gen) VALUES ('$genno', '$genno')") or die(mysql_error()); mysql_query("UPDATE $maintab SET gen='$genno' WHERE gen='fill'") or die(mysql_error()); mysql_free_result(); mysql_close; However, no matter how many times I run this code, it ALWAYS inserts the SAME number into the database. It works perfectly on localhost, but not when I upload it to my online host. I've asked them to check for any restrictions, but they showed me a test with rand function and it was working fine. Is it something in my code that is wrong? It inserts the random code into two tables in a database so I can match them up later, but one table always has the same code and the other table has a different code. Help! Thanks, Dan.
-
Hi, I have made a script that does something similar to this. http://www.example.com/download.php?fileid=3945 And then it finds the file and lets the user download it. However, I want to store the file outside of public_html folder so it can only be reached by that script, and not directly downloaded. Would I need some special PHP fetch function or can I just use a normal '/home/user' path? Thanks, Dan.
-
Hi, thanks for your reply, i'll be sure to use that. However, I have one more question. How would I go about selecting and printing all of the 'gcode' codes with the 'gen' of '23361207'. As you can see, some of the 'gcode' codes have the same 'gen' number. I want to print all of the codes with the gen number of '23361207'. Thanks.
-
I'm new to MySQL coding, and I was wondering how to do this. How would I go about calling the NAME, and then getting the contents of the "GEN" column from the row of the "NAME". I was thinking maybe this: ("SELECT gen FROM info WHERE name='new1' "); Is this correct?
-
Ok that works now, thanks, however, how would I go about matching the two ID's and displaying the codes? Here is what I did: mysql_query("INSERT INTO $maintab ($nametab, $linktab, $comptab) VALUES('$name', '$link', '$comp')") or die(mysql_error()); mysql_query("INSERT into $gcodetab ($codetab) VALUES ('$finalshuffle')") or die(mysql_error()); $codegen = mysql_insert_id(); mysql_query("UPDATE $maintab SET gen=$codegen WHERE gen='fill'") or die(mysql_error()); Thanks.
-
I have a script that creates a 'product' in a database and then shows it on a PHP page. When a new product is added, a 'generated code' is added to that product, using a few rand functions. A generated code is assigned to each product made. However, as you can see above, I have a 'generate new code' button. Here is what the phpmyadmin view looks like: I want to make it so that when you press the 'generate new code' button, it goes to that product in the database and ADDS another code. So I can have multiple generated codes attached to a single product. Is this possible? I have created the generating file & the adding products file, I just need help with the SQL PHP commands to get this 'multiple value add' to work. Thanks! Dan.
-
You could try putting it in a session variable. if(isset($_POST['arrayresult'])) { $_SESSION['carryover'] = $alert[$arrayresult]; } Then call it on the other page. echo $_SESSION['carryover']; EDIT: I see what you are trying to do, and realised it is a lot more tricky than I thought. Sessions would be one way of carrying over the result, as well as $_POST, but i'm not too sure how to get it to select between the arrays and send it.
-
Hi, No worries, thanks for the extra info! I'll be careful.
-
Thanks so much!
-
Hi, I'm still quite new to PHP. I really can't figure this out. I have a file called chmod.php which only admins can use. This file chmods a few other files that need to be written to on the server. However, chmod.php will ONLY chmod files if they aren't already writeable (is_writeable)... I want to add a link to the bottom of chmod.php that says "Force CHMOD" and I want it to go into a different mode, e.g: www.example.com/chmod.php will execute a normal chmod. www.example.com/chmod.php&mode=force will execute a force. How would I go about doing this in my script? Thanks!
-
How would I go about making double paragraph spacing between each piece of code written to config.php?
-
Thanks very much, both of you. I'll try that when I get home.
-
Hi, I have a file "install.php" which contains basic input data, ready to write to a "config.php" file. However, the install.php has a lot of data to write to config.php, not just the user input $_POST details, but a lot of pre-defined functions too. I can't put these all in a $ variable because it contains many " and '. How would I go about writing a large amount of data? Thanks.
-
Thanks, but weirdly enough, this is STILL showing it all at once. Do I need to set something in my php settings?
-
Hi, I am quite new to PHP and I am trying to use a sleep() function to delay the response of sending text. E.g: "Hello world 1" // Wait 3 seconds "Hello world 2" // Wait 3 seconds "Hello world 3" // etc... I have tried to use sleep(3) but it just ends up either slowing down the whole script or showing all echo's after 3 seconds. Here is what I am doing. <?php echo "Hello world 1"; sleep(3); echo "Hello world 2"; sleep(3); echo "Hello world 3"; ?> Any advice? Thanks.
-
[SOLVED] Combining multiple functions with variables
DanC replied to DanC's topic in PHP Coding Help
Thanks! -
Hi everyone, I am new to PHP and couldn't find a solution to this problem. I am trying to add strip_tags and a ucwords to a variable. So I have : $name = strip_tags($_POST['name']) ...and I want to apply both a strip_tags AND a ucwords to it. How would I do this? Thanks.