Jump to content

EricOnAdventure

Members
  • Posts

    80
  • Joined

  • Last visited

Posts posted by EricOnAdventure

  1. I would completely disregard the "hack" I suggested.  Kicken's fiddle clearly shows this working without a hack.

    I recommend you revert back to what it was before you took that advice, and then figure it out from there.

    I reverted back, but still I cant get his fiddle to work, maybe some interference with a script?

    Zane since you have the theme could you take a quick look at it and see if you can figure out why it doesn't work? I would like it to work, but nothing I do works.

  2. Thanks Kicken, I tried that but I can't seem to get it right. Here is what the var dump gives m

     

    array(10) { ["Details"]=> array(0) { } ["HasEditGrant"]=> bool(true) ["CancelUrl"]=> string(28) "unidata.php?operation=return" ["EditUrl"]=> string(32) "unidata.php?operation=edit&pk0=1" ["PrintOneRecord"]=> bool(false) ["PrintRecordLink"]=> string(36) "unidata.php?operation=printrec&pk0=1" ["ExportButtons"]=> array(0) { } ["Title"]=> string(7) "Unidata" ["PrimaryKeyMap"]=> array(1) { ["id"]=> string(1) "1" } ["Row"]=> array(79) { ["University"]=> array(3) { ["Caption"]=> string(10) "University" ["Value"]=> string(24) "Alabama A & M University" ["DisplayValue"]=> string(24) "Alabama A & M University" } ["STABBR"]=> array(3) { ["Caption"]=> string(6) "STABBR" ["Value"]=> string(2) "AL" ["DisplayValue"]=> string(2) "AL" } ["PREDDEG"]=> array(3) { ["Caption"]=> string(7) "PREDDEG" ["Value"]=> string(1) "3" ["DisplayValue"]=> string(1) "3" } ["HIGHDEG"]=> array(3) {

     

    every key combination I have tried has failed completely, any advice?

  3. Thanks Kicken,

    I've been trying to follow your advice but I haven't ended up anywhere better.

    in $Grid, the 3rd array is the University Key

    I tried everything I could think of to get it to work from this point, but everything failed. Any advice on which direction I should take this?

  4. Hey Kicken, your right that is generated by smarty so editing that file is rather pointless

    So let me display what print r gives me

    for $grid.row and $grid I get this

     

    Array ( [university] => Array ( [Caption] => University [Value] => Texas A & M International University [DisplayValue] => Texas A & M International University ) [sTABBR] => Array ( [Caption] => STABBR [Value] => TX [DisplayValue] => TX ) [PREDDEG] => Array ( [Caption] => PREDDEG [Value] => 3 [DisplayValue] => 3 ) [HIGHDEG] => Array ( [Caption] => HIGHDEG [Value] => 4 [DisplayValue] => 4 ) [CONTROL] => Array ( [Caption] => CONTROL [Value] => 1 [DisplayValue] => 1 )……and so on….

     

    for $Grid I also get all of the above, except I also get a few other pieces of data such as ID and database name.

     

    The warning I am getting is:

     

    Warning: Illegal string offset 'University' in C:\xampp\htdocs\uni\templates_c\%%C6^C67^C6773CE7%%gridusa.tpl.php on line 26

    Warning: Illegal string offset 'DisplayValue' in C:\xampp\htdocs\uni\templates_c\%%C6^C67^C6773CE7%%gridusa.tpl.php on line 26
    u
     

    Notice the "u" on the 2nd notice. I get 8 of these warnings and 4 "u"'s

     

    Line 26 comes from the generated file, as follows

    <?php $_from = $this->_tpl_vars['Grid']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
        foreach ($_from as $this->_tpl_vars['row']):
    ?>
    //line 26 is the one below.
    <?php echo $this->_tpl_vars['row']['University']['DisplayValue']; ?>
    
    <?php endforeach; endif; unset($_from); ?>
    

    I have no idea why the U even exists, and it exists for matter what I am calling for.

    Any ideas?

  5. I cant seem to make lasting changes to this file, at least not now, as the program is auto-changing this file as I make changes to my templet. I disabled warnings, thinking that would fix the issue, at least for now, and it did, except that it also helped me spot a new issue.

     

    So I am not only getting the row sent back to me, but also u

     

    for example

     

    u u u U Saint Augustine College

    u u u U IL,

    u u u U 2,

     

    This is what I get from my first three trials related to :

        {foreach from=$Grid item=row}
      {$row.XXXXXX.DisplayValue}
    {/foreach}

    XXXXXbeing whatever it is I am calling.

  6. What a fun approach, anywhere here is what I get, (FYI I changed the university and therefor data row from the previous data)

    array(0) {
    }
      
    
    bool(true)
      
    
    string(28) "unidata.php?operation=return"
      
    
    string(34) "unidata.php?operation=edit&pk0=552"
      
    
    bool(false)
      
    
    string(38) "unidata.php?operation=printrec&pk0=552"
      
    
    array(0) {
    }
      
    
    string(7) "Unidata"
      
    
    array(1) {
      ["id"]=>
      string(3) "552"
    }
      
    
    array(79) {
      ["University"]=>
      array(3) {
        ["Caption"]=>
        string(10) "University"
        ["Value"]=>
        string(23) "Saint Augustine College"
        ["DisplayValue"]=>
        string(23) "Saint Augustine College"
      }
      ["STABBR"]=>
      array(3) {
        ["Caption"]=>
        string(6) "STABBR"
        ["Value"]=>
        string(2) "IL"
        ["DisplayValue"]=>
        string(2) "IL"
      }
      ["PREDDEG"]=>
      array(3) {
        ["Caption"]=>
        string(7) "PREDDEG"
        ["Value"]=>
        string(1) "2"
        ["DisplayValue"]=>
        string(1) "2"
      }
    
  7. Ok thanks, that works, although I get quite a few warnings all related to line 26 in an associated file

    <?php $_from = $this->_tpl_vars['Grid']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
        foreach ($_from as $this->_tpl_vars['row']):
    ?>
    !!!!!!line 26--->  <?php echo $this->_tpl_vars['row']['University']['DisplayValue']; ?>
    
    <?php endforeach; endif; unset($_from); ?>
    
  8. Thanks muddy,

    I am sure that would work in normal conditions, unfortunately as this generator uses smarty the code runs into conflict with smarty's code...

    Here is how the page creates an output of every bit of info in the array.

     

     

    </table>
           <div class="">
                 <div class="col-lg-8">
                    {foreach from=$Grid.Row item=Cell}
                        <div class="form-group">
                            <label class="col-sm-3 control-label">
                                {$Cell.Caption}
                            </label>
                            <div>
                                <div class="form-control-static">
                                    {$Cell.DisplayValue}
                                </div>
                            </div>
                        </div>
                    {/foreach}
                </div>
            </div>

     

    Might this help you beter understand how this system works? If I can just out the information associated with the university then I can figure out the rest.

  9. Hey guys I need a bit of help with associative arrays.

     I am using the mysql php generator to create a rather nice searchable database. The software uses smarty as to reate page templets, that may be useful for my issue.

     

    My issue is this I want to echo an aspect of an array but I can get that to happen, if I print the array I get this:

    Array ( [university] => Array ( [Caption] => University [Value] => Texas A & M International University [DisplayValue] => Texas A & M International University ) [sTABBR] => Array ( [Caption] => STABBR [Value] => TX [DisplayValue] => TX ) [PREDDEG] => Array ( [Caption] => PREDDEG [Value] => 3 [DisplayValue] => 3 ) [HIGHDEG] => Array ( [Caption] => HIGHDEG [Value] => 4 [DisplayValue] => 4 ) [CONTROL] => Array ( [Caption] => CONTROL [Value] => 1 [DisplayValue] => 1 )……and so on….

     

    how would I go about echoing only the 'university'?

    I’ve tried a lot of combinations, but nothing seemed to work, any idea?

  10. Zane, thanks for your hack but it is still not working for me. Perhaps I did it wrong in some way? I tried many, many diffrent ways, but none works, Anyway here is the code as it is with me trying to reflect your hack as best I can...

    	<li class="active"><a href="#tab1">Step by Step Guide</a></li>
    	<li><a href="#tab2">Before You Apply</a></li>
    	<li><a href="#tab3">Your Application</a></li>
    	<li><a href="#tab4">Your Acceptance</a></li>
    	<li><a href="#tab5">Final steps</a></li>
    	<li><a href="#tab6">Cheap Travel Tips</a></li>
    </ul>
    <div class="col-lg-9 col-sm-9 tab-content animated-area">
    	<div class="row tab-pane fade in active" id="tab1">
    		<div class="tab-text col-lg-6 col-sm-6">
    			<h2>Your Step-By-Step Guide to Studying Overseas</h2>
    			<p class="margint20">
    				Below is our step-by-step guide to applying to any higher education program. Pay attention to the dates and if you decided you want to work with EfunStudies we will provide you even more information and help guide you through all the steps.
    				</p>
    			<ul class="margint30">
    				<li><i class="icon-long-arrow-right"></i> <a data-target="step2" class="tab1-anchor">One year before</a></li>
    				<li><i class="icon-long-arrow-right"></i> <a data-target="step3" class="tab1-anchor">10 months before</a></li>
    				<li><i class="icon-long-arrow-right"></i> <a data-target="step4" class="tab1-anchor">6 months before</a></li>
    				<li><i class="icon-long-arrow-right"></i> <a data-target="step5" class="tab1-anchor">5 months before</a></li>
    				<li><i class="icon-long-arrow-right"></i> <a data-target="step6" class="tab1-anchor">Cheap Travel Tips!</a></li>
    			</ul>
    		</div>
    		<div class="col-lg-6 col-sm-6">
    			<img src="temp/tab-image.png" class="img-responsive animated" data-animation="fadeInUpBig" data-animation-delay="0.3s" alt="" />
    		</div>
    	</div>
    	<div class="tab-pane fade" id="tab2">
    		<p class="about-title"><a href="#tab2" id="step2">Before You Apply (One year before you plan to start studying)</p></a>
    		1.	Find out what you want to study, think deeply about where you want to be in 5 or 10 years and then find the right program of study that will help you get there.
    		<br>2.	Search for universities with good programs that match your life goal and which you can get into based on your past performance. Choose several universities that you like.
    		<br>3.	Check out the universities’ websites. Which best suits you?
    		<br>4.	Check out the universities deadlines and requirements
    		<br>5.	Make plans to do an internship or volunteer in order to increase your chances.
    		</div>						<div class="tab-pane fade" id="tab3">
    		<p class="about-title"><a href="#tab3" id="step3">Your Application (10 months before you plan to start studying)</p></a>
    		1.	Prepare your Resume / CV (if needed), your Reference letters, and your Personal Statement.
    		<br>2.	Fill out your application form.
    		<br>3.	Double check all of your documents and your application.
    		<br>4.	Submit your application early, especially if there are rolling deadlines. DO NOT WAIT TILL THE LAST DAY. You should try to apply 1-2 months before the deadline or sooner.
    		</div>						<div class="tab-pane fade" id="tab4">
    		<p class="about-title"> <a href="#tab4" id="step4">Your Acceptance (6 months before you plan to start studying)</p></a>
    		1.	Wait.
    		<br>2.	Receive your acceptance letter and celebrate.
    		<br>3.	Your acceptance letter may or may not mention if you have already received scholarships or assistantships. 
    		<br>4.	Check for scholarships at the university that has accepted you, and in the country that you were accepted in for programs of the type you are studying.
    		<br>5.	Email your future head professor and ask for a Teaching and or Research Assistantships.
    		<br>6.	If your future head professor says no, then email other professors in your department.
    		<br>7.	Ask your head professor for any other financial aid that may be available.
    		</div>						<div class="tab-pane fade" id="tab5">
    		<p class="about-title"><a href="#tab5" id="step5">Final steps (5 months before you plan to start studying)</p></a>
    		1.	Choose which university you will be studying in.
    		<br>2. 	Get your transcripts from your previous schools and send them to the university you selected.
    		<br>3.	Sign up for an appointment with the embassy of the country you will be studying in.
    		<br>4.	Go to the embassy appointment, bring your acceptance letter with you. Apply for a student visa. (tip – don’t say you plan to work while studying abroad)
    		<br>5.	Prepare your tuition and pay it before the deadline.
    		<br>6.	Buy your airline ticket after you receive your VISA, not before!
    		</div>						<div class="tab-pane fade" id="tab6">
    		<div class="row">
    			<p class="about-title"><a href="#tab6" id="step6">Cheap Travel Tips</p></a>
    			I prefer to travel by land, to see the cities, the people, and the environments on the way, but sometimes I just don’t have the time to spend a few weeks or months crossing over land. In that case I do take planes. In the course of these flights, I have learned a few tricks. I have learned how to maximize my flexibility to lower my price, to use buddy passes, to make small regional hops and to hitchhike flights.
    			<p class="about-title">Flexibility</p>
    			The more flexibility you have with dates and locations, the more money you can save. For my last trip from Europe to the USA, I was able to get a flight, including all fees, taxes and Insurance for $200. I used two different websites Skyscanner.com and Momundo.com, both of which allow me to search whole months or even whole years and search multiple arrival and departure cities. I use both websites because they give different results. My flight time was flexible, I wanted to fly either in October or November, so I searched those months. Next I didn’t really care which city I left from, as I could easily travel to any major city in Europe for cheap. I also didn’t really care where I ended up in the USA, as I could also travel within the USA for fairly cheap. The tickets I found were as much as $1600, but one ticket was the cheapest of them all, Paris to New York City for $200. I bought it, and a few weeks later I traveled to the USA.<br>
    			When you are looking for flights you should try and be flexible about the date that you travel on. The more flexible you are, the cheaper the ticket.
    							<p class="about-title">Holidays</p>
    			My sister came to visit me in Asia during the summer, most of the tickets were %$2000+ but she was able to find a flight from the USA to China for only $400. Why was it so cheap? She left the USA on a Holiday, July 4th, the US Independence Day, and because very few people travel on this date she got a very cheap ticket. She also headed back to the USA at the end of the Chinese golden week, a time when everyone in china is heading home, and not to another country. Both ways her planes were almost empty, and both ways, here tickets were cheap.
    							<p class="about-title">Airport Hopping </p>
    			Long ago I was headed to the USA from the Ukraine. Flights were normally about  $1500. To save money I flew from one regional airport the next and saved about $1000. First I flew from the Ukraine to Turkey for $80, then after a short layover I was off to Germany for $50. I dashed to my next flight to Paris which was only 30$. In Paris I slept most of my 8 hour layover then headed to New York for $300.
    							<p class="about-title">Last Minute Tickets</p>
    			Did you know that some airlines will give you a discount on tickets that will be boarding ASAP?  Many airlines won’t drop the tickets unless there are quite a few empty seats and it is the very last minute, but I have gotten some very cheap tickets by waiting at the airport and asking about discounted flights.
    		</div>
    	</div>
    </div>
    
    				
    				
    				
    				</div>
    			</div>
    		</div>
    	</div>
    	<br>
    	<!-- FOOTER -->
    	<script>
    jQuery(function($){
        $("a.tab1-anchor").click(function(e){
             e.preventDefault();
             var theTab = "#" + $(this).data('target');
             $(theTab).trigger('click');
        });
    });
    </script>
    
  11. Hey guys, I am trying to put dynamically generated text into a database. The issue is the text can be 500 words+ when you include the HTML wrapping. I am not sure a database can hold it. I tried...

    CREATE TABLE `ericgonzp`.`3RLresult` (
    `id` INT(4) NOT NULL AUTO_INCREMENT ,
    `userhash` VARCHAR(50) NOT NULL ,
    `rl1ready` VARCHAR(3) NOT NULL ,
    `rl2ready` VARCHAR(3) NOT NULL ,
    `rl3ready` VARCHAR(3) NOT NULL , 
    `rl1result` VARCHAR(8000) NOT NULL ,
    `rl2result` VARCHAR(8000) NOT NULL ,
    `rl3result` VARCHAR(8000) NOT NULL ,                                      
     PRIMARY KEY (`id`)) ENGINE = InnoDB;
    

    Sadly this doesn't work...

     

    #1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

     

    Any idea what I should do?

  12. Hey guys, so I would like to know if there are any scripts out there (hopefully prewritten ones for sale or free) that could allow me to create a page like this, http://www.topuniversities.com/universities/university-cambridge#subject

    from my existing database. Clearly they are pulling a lot of information from their database and it is very interesting. Unfortunately I have no idea how to do it, nor what this is even called. Any ideas or advice? At this point I don't even have a useful google search term for a code that can create a page based on information in the database and comes with some nice CSS as this one does.

    Thanks

  13.  

    First, you need to decide what "is set" in the database means. Does it mean the field is NULL, an empty string, or what? Can the values you are pulling be FALSE? If not, have your function return the Boolean FALSE when the value is not set. Then you can do something like this:

    if(findit('DEGREETYPE','1moreinfo') !== false){
        //Do this
    } else {
        //Do that
    }

    Are you actually using the value from the DB or just checking if it "exists" (whatever that means). If you are just checking if the value exists, then have the function return TRUE/FALSE. Also, the !== is only needed if any legitimate values would be interpreted as false. For example, a value of 0 or an empty string would be interpreted as false, do the double equal sign is needed to do a strict comparison. If you won't have any such values in the return data, you could simplify it even more such as this:

    if(findit('DEGREETYPE','1moreinfo')){
        //Do this
    } else {
        //Do that
    }

     

    I see, thanks for the code, I didn't know it would be so easy. And yes, for the most part I just need to see if they are set because I'm using many as booleans

  14. If you are writing a function to pull one column at a time and plan on using it to repeatedly pull different columns from your database, that is truly a poor use of resources. Do not plan on pulling data one column at a time.

     

    The function only exits to get 1 $var at a time, I may use it at most 2x at once. But usually just once.

     

    Have you looked at the example code in the PHP manual? By the way, PDO is a lot easier than mysqli, especially when dealing with prepared statements. So unless you've reached the point-of-no-return, you should seriously consider switching to PDO.

    Ok thanks, I will move to PDO.

  15.  

    It is good that you are aware of real_escape_string(), however, no one uses it anymore.  Instead, use a prepared statement ideally PDO.  While there is fancy binding and the like, start off simple.

    $username = $_SESSION[info]['username'];        
    $query = "SELECT $column FROM $table WHERE username =? limit 1"; //Why not hard code your column and table names?
    $stmt->$yourDataBaseConnection->prepare($query);
    $stmt->execute([$username]);
    $rs=$stmt->fetch(); //Or fetchAll() or fetchColumn().  Also, add parameters such as PDO::FETCH_OBJ.

     Could you provide this in mysqli...my code is mysqli and I have a sight grasp over that...PDO is still beyond me.

  16.  

    It is good that you are aware of real_escape_string(), however, no one uses it anymore.  Instead, use a prepared statement ideally PDO.  While there is fancy binding and the like, start off simple.

    $username = $_SESSION[info]['username'];        
    $query = "SELECT $column FROM $table WHERE username =? limit 1"; //Why not hard code your column and table names?
    $stmt->$yourDataBaseConnection->prepare($query);
    $stmt->execute([$username]);
    $rs=$stmt->fetch(); //Or fetchAll() or fetchColumn().  Also, add parameters such as PDO::FETCH_OBJ.

    The columns and tables are not hard coded because this is part of a function that should help me pull only 1 $var at a time.

    Thanks for the advice, I'll work on applying it :)

  17. So since hacking a session is an issue, I of course need to protect my database from what is coming in with a real_escape_string();

    Next your suggesting I should hash the UserID, you have a good point but as a user would have to already be logged in to even access this or similar code, and the login is rather secure, would I need to do that, or would it, as it is, be secure enough?

  18. Hey guys, I have a working mysqli function that pulls info from the database

    so this works perfectly :

    $DEGREETYPE = findit('DEGREETYPE','moreinfo');
    echo $DEGREETYPE;
    

    However I would like to see if degree type is set, and since I cannot use isset with a function I tried this

    if(findit('DEGREETYPE','moreinfo')!=''){$DEGREETYPE = findit('DEGREETYPE','moreinfo');}else {$DEGREETYPE='nooo';}
    echo $DEGREETYPE;
    

    sadly this didn't work

    any ideas?

  19. Hey guys, I wanted to know if this was safe. After a user logs in, and I want to get some information I have an SQL function and part of it goes

     

    $username = $_SESSION[info]['username'];        

    $query = "SELECT $column FROM $table WHERE username ='$username' limit 1";

     

    I am also using INSERT INTO sometimes

     

    Because I am getting the username from the session is there a security issue I should be aware of?

     

×
×
  • 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.