Jump to content

Mace

Members
  • Posts

    36
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Mace

  1. The page you want to fetch is a page that fetches data with ajax. The simplehtmldom class isn't compatible with that. The requested url = http://www.ebay.com/cln#{"category":{"id":1,"text":"Collectibles"}} However, only javascript can read the part after the #. So that's why your request returns only http://www.ebay.com/cln#. So the only thing I tell you is that this won't work what you're trying to achieve. Maybe there is an RSS feed? of maybe there is way to browse without a # in your browser?
  2. I wrote you an example to give you an idea how to work with a php class. class MyClass { protected $arg; // this function will be called if you create the class public function __construct($creationArg) { // using "$this" will refer to the class itself // the protected $arg defined at the start is avaible with $this $this->arg = $creationArg; } public function MyFunctionInClass() { // the $this is still avaible here. return $this->arg; } } $myClass = new MyClass('Hello world'); echo $myClass->MyFunctionInClass(); exit;
  3. remove the column "id" in your inner select. This conflicts the columns you want to est.
  4. However, you could still redirect with javascript: if($failed == false) { ?> <script> window.location="premier_view.php"; </script> <?php exit; }
  5. This is because you already outputted html at the top of your file. First build all your php code, and then output your html. Not the other way around. After outputting html/echo/any other output, you cant do header(Location) anymore.
  6. Try this. Just check if the query failed. If not, then redirect. Also, dont put your $_POST values unprotected in your INSERT query. Use something like mysql_real_escape_string() on all your $_POST values <?php include_once '../includes/db_connect.php'; include_once '../includes/functions.php'; sec_session_start(); if (login_check($mysqli) == true) { $logged = 'in'; } $error_msg = ""; $username = $_SESSION['username']; $email = $_SESSION['email']; $id = $_SESSION['user_id']; // create string of queries separated by ; //var_dump(login_check($mysqli)); //var_dump($_SESSION); exit; //var_dump($_POST);exit; $query = "UPDATE members SET level = '$_POST[level]' WHERE id = $id;"; $query .= "INSERT INTO members_info ( id , fname , known_as , lname , gender , race , start_date , department , msisdn , dob , details , emergency_contact , emergency_msisdn ) VALUES ( '".mysql_real_escape_string($_POST['user_id'])."' , '".mysql_real_escape_string($_POST['fname'])."' , '".mysql_real_escape_string($_POST['known_as'])."' , '$_POST[lname]' , '$_POST[gender]' , '$_POST[race]' , '$_POST[start_date]' , '$_POST[department]' , '$_POST[msisdn]' , '$_POST[dob]' , '$_POST[details]' , '$_POST[emergency_contact]' , '$_POST[emergency_msisdn]' );"; // execute query - $result is false if the first query failed $result = mysqli_multi_query($mysqli, $query); $failed = false; if ($result) { do { // grab the result of the next query if (($result = mysqli_store_result($mysqli)) === false && mysqli_error($mysqli) != '') { echo "Query failed: " . mysqli_error($mysqli); $failed = true; } } while (mysqli_more_results($mysqli) && mysqli_next_result($mysqli)); // while there are more results } else { echo "First query failed..." . mysqli_error($mysqli); $failed = true; } $mysqli->close(); if($failed == false) { header('Location: ../success.php'); exit; }
  7. Try setting a cronjob. That's a scheduled action on your server. http://en.wikipedia.org/wiki/Cron
  8. My guess is that the number is echo'd in one of the include_once files.
  9. just add all the files you want to grant acces to in the array $allowed. place this code in the function. if($_SESSION['level'] == 0) { header('Location:info.php'); exit; } and i would do the session start before the checkLoginLevel. checkLoginLevel(); sec_session_start();
  10. I'm not sure if you mean something like this, but i'll give it a try function checkLoginLevel() { $allowed = array( '1' => array('first-page.php'), '2' => array('first-page.php', 'second-page.php'), '3' => true, ); if(!isset($allowed[$_SESSION['level']])) { echo 'You have no login level'; exit; } if(is_array($allowed[$_SESSION['level']])) { $file = $_SERVER["PHP_SELF"]; $file = explode('/', $file); $file = end($file); if(!in_array($file, $allowed[$_SESSION['level']])) { echo 'You are not allowed on this page'; exit; } } if(is_bool($allowed[$_SESSION['level']])) { // you're allowed; } }
  11. So if login_check($mysqli) returns true, your problem is not in the login check. However you haven't post any other part of your code so we have no clue why the wrong pages are being displayed.
  12. It might be easier to find the problem by finding out which condition is invalid. Try an echo at every possible return false. if ($login_check == $login_string) { // Logged In!!!! return true; } else { // Not logged in echo 1; return false; } } else { // Not logged in echo 2; return false; } } else { // Not logged in echo 3; return false; } } else { // Not logged in echo 4; return false; } } Depending on which number is echo'd you know where your problem is.
  13. ginerjm solution is this: elseif(!(is_numeric($_POST['number1']) && is_numeric($_POST['number2']) && is_numeric($_POST['number3']) && is_numeric($_POST['number4']))){
  14. the attribute with the value _blank is target so maybe try a[target=_blank]. The page might also be blank because there is a php error. Try setting your error reporting on E_ALL.
  15. It says you have to set a key is you want to use auto increment. In this case you want to make it a primary key. CREATE TABLE `$burger` ( `id` INT NOT NULL AUTO_INCREMENT, `event_id` CHAR(50) NOT NULL DEFAULT '0', `name` CHAR(100) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) COLLATE='utf8_unicode_ci';
  16. I have been looking for some good libraries a couple of months ago and I found the following lib: http://simplehtmldom.sourceforge.net/ It has very easy documantion and it really does everything you want to achive. // Create DOM from URL or file $html = file_get_html('http://www.google.com/'); // Find all images foreach($html->find('.maintbl td') as $element) echo $element->src . '<br>'; See if maybe this lib helps
  17. After setting the mysql_query you still have to call a mysql_fetch function with the result. use for an example: http://nl3.php.net/manual/en/function.mysql-fetch-assoc.php $result=mysql_query("SELECT * FROM `eusers` WHERE id='".$_SESSION['uid']."'"); while ($row = mysql_fetch_assoc($result)) { if($row['MENUAdviser']=="Y"){ echo '<script type="text/javascript" src="ExtranetMenu.js"></script>'; } if($row['MENUPAS']=="Y"){ echo '<script type="text/javascript" src="PASMenu.js"></script>'; } if($row['MENUStaff']=="Y"){ echo '<script type="text/javascript" src="IntranetMenu.js"></script>'; } if($row['MENUWebAdmin']=="Y"){ echo '<script type="text/javascript" src="WebAdminMenu.js"></script>'; } } Also, if you use if statements. Use the == operator instead of a single =. Otherwise it wont work.
  18. where do you output this text: record has been successfully added. Please wait to be redirected. Maybe it's right after that sentence.
  19. I have no idea where that text is coming from
  20. the function you're calling for send is indeed setting the headers for a download, however it does not contain the file you want to save. Usually when these headers are sent the file is already saved on your server en after setting the headers the function readfile or file_get_contents is called to complete the download request. So, the send function is not sufficient to help you on saving the file. If you have found the filedata you want to save, try using the file_put_contents function. That's my favorite function to save files on the server. Since your current function is an export it's logical to open the export in a new window. The new window will become a download. However if you want to save the file, maybe try something like this: var myWindow = window.open('inc/export_hitlist.php?paid='+info, 'Export');myWindow.opener.alert('File is saved'); myWindow.close();
  21. if you don't have the original source, replace split with preg_split .
  22. You have a ; after your if statement if (! $insert_stmt->execute()); remove that ; because a ; means that no action will follow if the if statement is valid. Also, put this line in comments printf("%d Row inserted.\n", $insert_stmt->affected_rows); Otherwise you'll get a syntax error because the { will open too late.
  23. Did you check what cyberRobot suggested? first an echo "here"; and then after the $sql echo $sql;
  24. and I was wondering why you were buffering your output with ob_start(); but i see that cyberRobot already put it in comments in his post.
×
×
  • 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.