Jump to content

rockstarrem

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by rockstarrem

  1. I may be missing something stupid, but where is the function is_authed defined?
  2. if (($ext == "jpg") ||($ext == "gif") || ($ext == "png") && ($_FILES["uploaded_file"]["type"] == "image/png" || "image/jpeg" || "image/gif") && That should work. If not, try a different syntax. OR just lose it all together for all file types (do not recommend this at all).
  3. Not really, but I found this topic at another forum... if this is against the rules I'm sorry, just delete it etc: http://www.codingforums.com/showthread.php?t=57548 -- that should give you the basic idea, if it even works.
  4. You're probably going to want to use IPB's session and see how long it's been since the last time they used a quote. This would probably be the easiest and most effective way. IP's are alright but people can just use a proxy and stuff.
  5. So you're offering people the same file to buy as what you're letting them view on your website? I'm a bit confused, but what I suggest you do is to encode a 30 second sample of the video. Why would they buy the video if they can just watch it on your website? It's the same file, quality etc...
  6. Thanks a lot! Works perfectly. Really appreciated.
  7. I switched to Ken's code and did as you told me and now whenever I submit anything, even when I do fill out the form with content it still says that all variables are empty. I should also note that before when I had it working it submitted the form four times, which is the number of variables I'm using. I'm guessing that's from the foreach? Here's the full code: <?php $album = $_POST["cd_album"]; $artist = $_POST["cd_artist"]; $year = $_POST["cd_year"]; $genre = $_POST["cd_genre"]; require_once("mysqli.connect.php"); $vars = array( 'album' => 'CD Album', 'artist' => 'CD Artist', 'year' => 'CD Year', 'genre' => 'CD Genre' ); $filled = false; foreach ($vars as $var) { if (isset($$var) && strlen($$var) > 0) { $filled = true; //Prepare formatting for mySQL. $album = $mysqli->real_escape_string($album); $artist = $mysqli->real_escape_string($artist); $year = $mysqli->real_escape_string($year); $genre = $mysqli->real_escape_string($genre); $query = "INSERT INTO cd (album, artist, year, genre) VALUES ('$album', '$artist', '$year', '$genre')"; $mysqli->query($query, MYSQLI_STORE_RESULT); printf("Added: (%s) %s - %s GENRE: %s", $year, $album, $artist, $genre); } else { $filled = false; } } if (!$filled) { echo "all the variables are not filled\n"; } else { echo "all the variables are filled\n"; } ?>
  8. I'm not using Ken's code because I was unsure if it would work with user input or not. I'm using sspoke's code. I was also wondering if I could put all the variables that I'm using in an array instead of checking $_REQUEST, like this: $variables = array($cd_album, $cd_artist, $cd_year, $cd_genre); That way I could take out variables in the future that I don't want to be checked on that page. But I'm still wondering about my last question too because I'm using sspoke's code. Thanks for all the help .
  9. Hey guys, Thanks for the help! It does exactly what I want it to. Just another question though, say I want it to return something else other than "variable is empty.", like, instead of cd_genre is empty, I want it to say CD Genre is empty. How would I do this? Again, thanks for the help .
  10. Hey guys, Really dumb question, but I want to check if a bunch of variables are all not empty. Then, if they aren't, I want to execute a mySQL query. Right now I have this which I know is wrong because it doesn't work the right way: if($album != null || $artist != null || $year != null || $genre != null) { // stuff here... } Obviously I want all of those variables to be checked if they are empty or not. I did a quick Google and found that checking if the variables are null wouldn't be the correct way of solving this situation because an "empty string" is still not null? Anyway, any help would be appreciated. I'm pretty sure it's really simple .
  11. Wow, nevermind. Forget this lol. Sorry, sometimes I just have a huge brain fart.
  12. I'd look into Shared hosting from DreamHost or somewhere similar if that was the case.
  13. I'll explain... The CMS takes user input, so if the page name is "sadasdasd" it will create a table "pages_sadasdasd". Edit: Epic failure. I sincerely thought it wasn't a MySQL problem, but the column was "pagecontent" instead of "postcontent". Sorry
  14. $mysqli->error(); returns this: <?php //bla bla bla $mysqli = new mysqli(); $mysqli->connect("localhost", "root", "", "jesus"); $newquery = 'SELECT id, postcontent FROM pages_sadasdasd ORDER by id'; $result2 = $mysqli->query($newquery, MYSQLI_STORE_RESULT); echo $mysqli->error(); //rest part of the code ?>
  15. Yes, the CMS is written that way.
  16. Hello, I'm having a really big problem that I can't figure out. Basically, my first code snippet works fine, it gets the navigation from the database with no problem. But, when I'm trying to get another table from the database, I get this: The navigation fetches fine, but the "pagecontent" doesn't. Here's my code. <html> <head> <title> </title> <link href='../css/index.css' type='text/css' rel='stylsheet' /> <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'> </head> <body> <div id='banner' /> </div> <div align='center' id='nav' /> <?php $mysqli = new mysqli(); $mysqli->connect('localhost', 'root', '', 'jesus'); error_reporting(E_ALL); $query = 'SELECT name, url FROM navigation ORDER by id'; $result = $mysqli->query($query, MYSQLI_STORE_RESULT); while(list($name, $url) = $result->fetch_row()) printf("<a href='%s'>%s</a> | ", $url, $name); $result->close(); ?> </div> <div id='content' /> <?php $mysqli = new mysqli(); $mysqli->connect('localhost', 'root', '', 'jesus'); error_reporting(E_ALL); $newquery = 'SELECT id, postcontent FROM pages_sadasdasd ORDER by id'; $result2 = $mysqli->query($newquery, MYSQLI_STORE_RESULT); while(list($id, $pcontent) = $result2->fetch_row()) printf("%s %s", $id, $pcontent); if ($mysqli->errno) { printf("Unable to connect to the database:<br /> %s", $mysqli->error); exit(); } $result2->close(); ?> </div> </body> </html> Thanks!
  17. Hello guys, I made a form and the submit button is not showing up. <form method="post" action="do_news.php"> Date (YYYY-MM-DD): <input type="text" name="date" /><br /> Poster: <input type="text" name="poster" /><br /> Post: <br /> <textarea name="post" cols="100" rows="20" /> <input type="submit" /> </form> Any suggestions?
  18. Hello, It's still not working: My code is... <?php $mysqli = new mysqli(); $mysqli->connect("localhost", "root", "", "jesus"); $title = $_POST["title"]; $name = $_POST["name"]; $post = $_POST["new_post"]; $newquery = "INSERT INTO `jesus`.`posts` ( `title` , `name` , `post` ) VALUES ('$title', '$name', '$post');"; $title = $mysqli->real_escape_string($title); $name = $mysqli->real_escape_string($name); $post = $mysqli->real_escape_string($post); $mysqli->query($newquery, MYSQLI_STORE_RESULT); if ($mysqli->errno) { printf("Unable to connect to the database:<br /> %s", $mysqli->error); exit(); } echo "Success!"; ?>
  19. I fixed the above problem, but I'm still getting this: My code is... <?php $mysqli = new mysqli(); $mysqli->connect("localhost", "root", "", "jesus"); $title = $_POST["title"]; $name = $_POST["name"]; $post = $_POST["new_post"]; $newquery = "INSERT INTO `jesus`.`posts` ( `title` , `name` , `post` ) VALUES ('$title', '$name', '$post');"; $link = mysql_connect("localhost", "root", ""); mysql_real_escape_string($title); mysql_real_escape_string($name); mysql_real_escape_string($post); $mysqli->query($newquery, MYSQLI_STORE_RESULT); if ($mysqli->errno) { printf("Unable to connect to the database:<br /> %s", $mysqli->error); exit(); } echo "Success!"; ?>
  20. I get a few of these errors now: Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\do_blog.php on line 10 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\do_blog.php on line 10 Unable to connect to the database: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', 'Domenic's', 'Testing's')' at line 1 My code is: <?php $mysqli = new mysqli(); $mysqli->connect("localhost", "root", "", "jesus"); $title = $_POST["title"]; $name = $_POST["name"]; $post = $_POST["new_post"]; $newquery = "INSERT INTO `jesus`.`posts` ( `title` , `name` , `post` ) VALUES ('$title', '$name', '$post');"; mysql_real_escape_string($title); mysql_real_escape_string($name); mysql_real_escape_string($post); $mysqli->query($newquery, MYSQLI_STORE_RESULT); if ($mysqli->errno) { printf("Unable to connect to the database:<br /> %s", $mysqli->error); exit(); } echo "Success!"; ?>
  21. Hello, I'm learning PHP/MySQL and I'm running into some trouble. When I post something from PHP to the database with something like ' in the post, I get the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm here ')' at line 1 So I get it's saying that my MySQL syntax is wrong and it's passing the ' from the post like it's actual syntax... heres my code: <?php $mysqli = new mysqli(); $mysqli->connect("localhost", "root", "", "jesus"); $title = $_POST["title"]; $name = $_POST["name"]; $post = $_POST["new_post"]; $newquery = "INSERT INTO `jesus`.`posts` ( `title` , `name` , `post` ) VALUES ('$title', '$name', '$post');"; $mysqli->query($newquery, MYSQLI_STORE_RESULT); if ($mysqli->errno) { printf("Unable to connect to the database:<br /> %s", $mysqli->error); exit(); } echo "Success!"; ?>
×
×
  • 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.